News:

;) This forum is the property of Proton software developers

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

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

top204

#25
One thing to note Robert, is that the different families of PIC microcontrollers have different architectures, so they have some different mnemonics, and very different Peripheral, Flash memory, and RAM arrangements. So one PIC microcontroller family's code will not work on another.

The 18F and 14-bit core devices are very, very different, and the 'so called improved' enhanced 14-bit core devices are actually a step back in quality compared to 18F devices that have been around for over 20 years now. Microchip could have done so much more with a newer 8-bit architecture based upon the 18F and PIC24 devices, but they seem to screw things up so much now, there is no common strategy, just; "Buy what we can and sell it, regardless". It seems to now be a company owned and run by corporate crooks and Lawyers, and certainly not by people who actually use microcontrollers in the real world. :-)

Best regards
Les

streborc

Les,

Again, many thanks for the update (V4.0.6.4) that I downloaded and installed earlier today.  I recompiled all 3 of my test programs configured for the PIC18F47Q10, the PIC16F18346 and the PIC12F1840, and am pleased to report that the SHIn command now works in all of them.  I then substituted SHIn for my bit-basher in my PIC16F18346 based radio controlled clock application, and it functions perfectly as well.

In the course of dissecting every word in the Positron user manual while digging into this issue, I discovered a typo in the SHIn command description within the table of modes on page 185.  I believe the 4th item, Mode 3, should be "Shift data in lowest bit first" (rather than "highest").

Despite Microchip's success with its PIC family of microcontrollers, Microchip does seem to suffer many maladies of large corporations.  It does an extremely poor job documenting the PIC families and differentiating among its many part numbers in marketing materials.  Searching for a comprehensive selection guide to the PIC18's, for example, yields an antique chart of obsolete parts.  Users have to download a copy of every part's data sheet and compare dozens of parameters to make a selection, and often times, the differences seem negligible and hardly worth the effort of assigning a unique part number.  I suspect the entire PIC18 family comprises a single silicon die that is factory configured to enable the incremental features of each part number.  Perhaps this is the problem -- Microchip thinks it makes only one PIC18 microcontroller!

In any event, microcontrollers are an educational and enjoyable pursuit, made even more so with Positron.

All the best,
Robert

Frizie

What I consider a good selection guide is the Microchip Advanced Part Selector:
http://www.microchip.com/maps/Microcontroller.aspx

Very handy  ;D
Ohm sweet Ohm | www.picbasic.nl

streborc

Indeed this is - thanks very much!  My many searches never returned this as a hit.  It's now at the top of my bookmarks.