If I am just being thick headed let me know...Code:BSR = 0 'IN BANK 0 LATF = LATF ^ 32 'NOW IN BANK 7 CNT =CNT+1 'NOW WHAT???
If I am just being thick headed let me know...Code:BSR = 0 'IN BANK 0 LATF = LATF ^ 32 'NOW IN BANK 7 CNT =CNT+1 'NOW WHAT???
Dave
Always wear safety glasses while programming.
when PBP sees the LATF line, it switches to bank 7. when its done it automaticlly switches back to BANK 0. This way PBP can know it is always in BANK 0. So when it sees PIR1.1=0, this is a BANK 0 thing, it assumes it is in BANK 0 so it doesn't reset BSR. Now sometimes when my ISR is called, I was already in BANK 5. If the LATF line is in, PBP switches to 7, then back to 0 when done with LATF. When I rem LATF and enter the ISR in BANK 5, PBP doesn't know. So then everything that is supposed to happen in BANK 0 can't.
Adding BSR=0 as the first line in my ISR will ensure PBP won't be confused. Because the chip I am using does auto context save and restore, I don't need to worry about destroying the BSR in my ISR.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
I get it now..
LAT was/is doing the same thing as BSR , as far as the BANKs are concerned.
Thanks!!!!
now it is time for a nap..
Dave
Always wear safety glasses while programming.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Whew, thanks again Darrel. I was really having second thoughts for a min. Now my brain is all re-aligned for whatever tomorrow brings![]()
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
For the sake of clarity, LAT was not really doing the same thing as BSR. What it was doing was causing PBP to change banks to BANK7, therefore PBP also changed banks back to BANK0 when the LAT was done. With it remed, PBP assumed it was still in BANK0. SO when I entered the ISR with a different bank set, PBP didn't know. I gather from Darrels help in my "bug" thread, He tends to the BSR=0 in his DT_INT routine to avoid just such issues.
BTW, the only reason I can change BSR inside my ISR is because 16F1xxx automatically saves BSR upon entering an interupt. So BSR will change back when I return. Otherwise I would have needed to save the BSR to a temp, then restore it before leaving ISR.
Next up on the list of games is multiple interupts and checking who fired.![]()
This is great fun!!!
Last edited by cncmachineguy; - 21st December 2010 at 15:48. Reason: lost quote
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Been a while since I posted anything here. I am still working on this but things slowed through the holidays then I had some mechanical issues to resolve with the machine. But I am back on this now. Anyhow, here is my problem:
I have limit switches on each axis of travel. 1 switch also doubles as a home switch for each axis. Because I have too much I/O to report everything to EMC, I am using my card to watch the switches. This way I can report the "home" switches and throw an E-stop if any other limits are hit.
Now for the question: when the machine homes, it is set up to do 1 axis at a time, leaving the axis on the home switch. I need to be able to ignore the switch until homing is complete (i have that working) but also need to ignore them until the first time the axis moves off the switch. Does this make sense? I am sure this will need some flags, but I am at a loss as to how to do the checking without having a zillion IF's and so forth.
Any suggestions/questions?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Finally got past my logic issues, Just thought I would post a pic of the card with stepper drives attached.
Thanks to all who have helped me get this far. This is a fully functional "phase 1" card. Now the fun really begins
BTW, for any who are intrested, pics of the machine will be up soon over at Foam Casualty
Last edited by cncmachineguy; - 14th February 2011 at 15:16.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Nice!!!
Looking forward to seeing vids of it running.
Dave
Always wear safety glasses while programming.
Thank you,
They are coming Dave![]()
Last edited by cncmachineguy; - 15th February 2011 at 01:56. Reason: typo
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks