News:

Let's find out together what makes a PIC Tick!

Main Menu

SHIn and SHOut

Started by streborc, Mar 07, 2026, 10:38 PM

Previous topic - Next topic

streborc

I conducted this same test on two other PIC devices, a 12F1840 and an 18F47Q10.  There was no difference in the SHIn behavior on the 12F1840.  However, SHIn does receive its input on the 18F47Q10.  I should note that the serial LCD I was using to display the three Reg_byteX values in my test did not want to work on the 18F47Q10's PortA where the SDI, SDO and SCK pins were assigned, and had to be moved to PortB -- maybe a read/modify/write collision?  (There was no such problem on the 12 or 16 devices.  I might investigate further.)

Is this exclusionary use of SHIn on the 12 and 16 PIC families by design, or is it by limitation of these less capable uC's?  Perhaps I should graduate all my projects to PIC18 devices(?).

streborc

Below are the assembly code excerpts for SHIn from the PIC18F47Q10 and PIC16F18346 test programs.

SHIn_Assembly_Code.png

trastikata

#22
Del

streborc

My last post was incomplete, and listed only the library code from the assembly file.  Below is the assembly code for the SHIn instruction Shin SDI, SCK, 0,[Reg_byte2]

SHIn_Assembly_Code.pdf 

trastikata

Hi,

Can you share the entire Assembler code, from beginning to the end for both working and not working programs and indicate the device in the name of the txt file.

Thank you.

top204

Many thanks for your findings, and determination streborc.

I have located the problem, and it is with the SHin command on one of the first generation enhanced 14-bit core devices. These did not share a RAM bank for PORT and TRIS, so the compiler has 2 SHin and SHout library subroutines, one for the early enhanced 14-bit core devices, and one for the later enhanced 14-bit core deviecs, that share a RAM bank with PORT and TRIS.

So now I have made the changes, it is working on all enhanced 14-bit core types, and I will upload an update for the compiler ASAP.

However... This means that the problem with SHin and SHout on the first generation enhanced 14-bit core devices, has been with the compiler from day one. Around 15 year, and nobody has noticed it!

Regards, and thanks
Les


streborc

Les,

Many thanks to you for chasing down and implementing a remedy for this anomaly.  Your commitment to Positron and its user community is unparalleled throughout the compiler universe!

All the best,

streborc