Got it downloaded. Will be playing with a K42 for the next day or 3!
Got it downloaded. Will be playing with a K42 for the next day or 3!
Playing with a PIC18F26K42, when I tried to compile I got a library of errors. The magic one was "Unable to find P18F26K42.INC". I had to go into MPLABX/V4.05 and copy the files for all of the K42s into PBP3.1/Temp. After that it compiled.
Turns out PBP was using MPASM V.5.71 from MPLABX V.4.01. Once I pointed it to the new folder, it works. Details:
http://support.melabs.com/forum/picb...-missing-files
Got the obligatory blinked LED Hello World out of the way. Played with NCO, lit up an LCD, still want to explore the Vectored Interrupts that allegedly make the DT_INTS obsolete.
Got legacy ADC working in 12-bit mode. Took about a day of trial & error but I got Vectored Interrupts working. I pored over the Data Sheet and TB3162, did a bunch of copy/paste, fixed one thing that didn't work the way the DS claimed, and it works! Don't know what I'm doing, but I can build from here, tweaking for application. Getting stoked!
In the Data Sheet, it says to Label your ISR, then (in ASM) CODE and an address; "T1INT: CODE 0x08C0". That did not work. What I had to do was on the line before the Label T1INT I had to add (again, in ASM) "ORG 0x08C0" and omit "CODE 0x08C0". That worked. Other than that it was just copying the Vectored Interrupt ASM code from the Data Sheet. Upon request I can upload the example I got working on a PIC18F26K42.
Well done! I have not got the update nor any K42's to play with yet.
Regarding the vectored interrupts, don't forget that STILL can't use PBP inside your interrupt handlers, doing so without extreme care WILL screw you as we've discussed before. So if you want to use PBP inside your ISR then DT Ints is still your best bet (not sure why you've got the feeling it's obsolete) but DT Ints does not support the vectored interrupt system and the K42 would have to be bodged into the DT Ints code - which might prove more or less difficult.
Charles said something about "bad things happening" if you tried to use the vectored interrupt feature but he didn't go into any details, I wonder if it was a general thing or purely related to using PBP in the ISR (either ON INTERRUPT or DT Ints).
/Henrik.
I suppose there is a right way and a wrong way to attempt to implement Vectored Interrupts. The program I was testing really didn't do much of anything useful except display a message on the LCD. I used a Timer 1 interrupt to blink an LED and an INT0 interrupt from a push button to toggle an LED. The Main loop just paused and looped. The fact that 2 interrupts worked as intended, I assume 10 would work just as well. Don't know yet.
I haven't abandoned DT-INTS at all. In fact, I've spent lots of hours tweaking my version to accommodate newer PICs and their newer SFRs. For just about everything but the K42, DT-INTS is still the way to go. I guess I just enjoy the challenge of tackling something new once in awhile.
The K42 has builtin hardware context saving for both the high priority and low priority interrupts, which would make most of what DT-INTS does unnecessary. The list of registers it saves is pretty complete.
I haven't looked at all the details, but it looks like you might get away with just calling the SavePBP/RestorePBP routines in ReEnterPBP-18.bas/ReEnterPBP-18LP.bas
Bookmarks