can't help but notice your apa pin aliases are of the latx.y type
that is a definite no no for shiftout commandAPAData var LATE.1
APAClock var LATE.0
but you post no relevant info about the routine so its just a guess
gigo
can't help but notice your apa pin aliases are of the latx.y type
that is a definite no no for shiftout commandAPAData var LATE.1
APAClock var LATE.0
but you post no relevant info about the routine so its just a guess
gigo
Warning I'm not a teacher
Richard is right. you should use the PORT.X designation when defining pins to be used with SHIFTOUT or SHIFTIN.
APAData var PORTE.1
APAClock var PORTE.0
Dave Purola,
N8NTA
EN82fn
Thanks guys, I will try with the PortX.y version instead of LATX.y although what I don't understand is why it works with the LAT commands but only stops something on Port B from working when I am using the LATA.
I chose to use LAT instead of Port as I read somewhere that on chips with Latch registers you should use those to avoid Read/Modify/Write issues.
Will report back on my findings after I retest tomorrow evening.
Keith
www.diyha.co.uk
www.kat5.tv
I believe it's basically the same issue as Ioannis had the other day when he tried to use HIGH/LOW on anything but a PORT register.
Any command that automatically makes the pin in question and input or output (ie clears or sets the TRIS registers for you) must to use PORTx.y
This is because the compiler uses a hardcoded "offset" to get from the PORT register to the TRIS register.
On the 18F46K22 this "offset" between any of the PORT registers and their corresponding TRIS registers is 18 so if, for example, you use LATA.0 instead of PORTA.0 as your SHIFTOUT pin the result will be that the compiler clears OSCTUNE.0 instead of TRISA.0.
/Henrik.
Many thanks to Richard and Dave for letting me know I should be using PORT instead of LAT and thanks to Henrik for the explanation.
Making the changes has fixed the issue and also cured a couple of other bits of randomness that were also happening.
Upto this point the program has basically been proof of concept hence why various subroutines we prototyped on another PIC before being inserted into the main code. Time now to do an upto date printout and get the highlighter pens out to note all the changes I need to make to get my program tidied up and working the way I want it to.
Thanks again guys.
Keith
www.diyha.co.uk
www.kat5.tv
Bookmarks