ahhh thanks guys
fixed it toggling both
' CREN = 0
' SPEN = 0
I didn't bother with the interrupts just disabled the Port input thanks I appreciate it!!!
ahhh thanks guys
fixed it toggling both
' CREN = 0
' SPEN = 0
I didn't bother with the interrupts just disabled the Port input thanks I appreciate it!!!
Hi Darrell, I tried to use your great rutines without any luck. I'm using a 18F248 sending CAN messages and I want to use a timer interrupt to send it.
Just to test the rutines I tried to compile the example you post for timer interrupt and DT_INTS-18.bas rutines. But I got some errors on the compilation. Attached you will find a screen shot of what i'm talking about. If anybody can tell me what I'm doing wrong, it will be a great help for me.
Thanks in advance for all yor help
Alfredo
Hi Alfredo,
Well apparently, not all CAN modules are the same.
There are 2 types, CAN and ECAN.
I didn't consider the plain CAN module when I wrote it.
I'll have to make a way for it to detect which module is available and only use the interrupts for it. Then I'll post an update.
But for now, you can just comment out the interrupt Sources that aren't available.
In the DT_INTS-18.bas file, comment out the following lines in the CAN Module section ...Thanks for the info!Code:asm ; -- CAN Module -- ifdef WAKIF ;----{ CAN bus Error }------------------------[PIR3, ERRIF]--- INT_Source CAN_ERR_INT, PIE3,ERRIE, IPR3,ERRIP ;----{ Invalid Received Message }-------------[PIR3, IRXIF]--- INT_Source CAN_IRX_INT, PIE3,IRXIE, IPR3,IRXIP ;----{ Receive Buffer 0 }------Mode 0--------[PIR3, RXB0IF]--- INT_Source CAN_RXB0_INT, PIE3,RXB0IE, IPR3,RXB0IP ;----{ FIFO Watermark }--------Mode 1, 2---[PIR3, FIFOWMIF]--- ; INT_Source CAN_FIFOWM_INT, PIE3,FIFOWMIE, IPR3,FIFOWMIP ;----{ Receive Buffer 1 }------Mode 0--------[PIR3, RXB1IF]--- INT_Source CAN_RXB1_INT, PIE3,RXB1IE, IPR3,RXB1IP ;----{ Any Receive Buffer }----Mode 1, 2-----[PIR3, RXBnIF]--- ; INT_Source CAN_RXBn_INT, PIE3,RXBnIE, IPR3,RXBnIP ;----{ Transmit Buffer 0 }-------------------[PIR3, TXB0IF]--- INT_Source CAN_TXB0_INT, PIE3,TXB0IE, IPR3,TXB0IP ;----{ Transmit Buffer 1 }-------------------[PIR3, TXB1IF]--- INT_Source CAN_TXB1_INT, PIE3,TXB1IE, IPR3,TXB1IP ;----{ Transmit Buffer 2 }-----Mode 0=-------[PIR3, TXB2IF]--- INT_Source CAN_TXB2_INT, PIE3,TXB2IE, IPR3,TXB2IP ;----{ Any Transmit Buffer }---Mode 1, 2-----[PIR3, TXBnIF]--- ; INT_Source CAN_TXBn_INT, PIE3,TXBnIE, IPR3,TXBnIP ;----{ CAN bus Activity Wake-up }-------------[PIR3, WAKIF]--- INT_Source CAN_WAKE_INT, PIE3,WAKIE, IPR3,WAKIP endif list endm list ENDASM
DT
WOOOOW!
Thank you very much for the info, now I can use your rutines!!! Your info fix my problem
Thanks again!!!
Alfredo
.Damn.. way to slow this time
my solution was..
From p18f8680.inc file...Code:asm RXBnIF=RXB1IF TXBnIF=TXB2IF FIFOWMIF=RXB0IF INT_LIST MACRO INT_Handler TMR1_INT, _ToggleLED1, PBP, yes endm INT_CREATE endasm
On another hand... seems odd...Code:;----- PIR3 Bits ----------------------------------------------------- RXB0IF EQU H'0000' RXB1IF EQU H'0001' TXB0IF EQU H'0002' TXB1IF EQU H'0003' TXB2IF EQU H'0004' ERRIF EQU H'0005' WAKIF EQU H'0006' IRXIF EQU H'0007' FIFOWMIF EQU H'0000' RXBnIF EQU H'0001' TXBnIF EQU H'0004'
Last edited by mister_e; - 30th May 2008 at 23:33.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Good one Steve. That would have worked too.
Since they're actually the same bit's, but with different Names depending on the mode, that might be an easy way for me to fix it. Maybe.
<br>
DT
But yeah... we know how Microchip work... hard to tell if it will always work... on all PIC
Worth a try!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Steve,
Do you know if the there is any difference in accuracy between using a xtal osc and the internal RC osc esp. in relation to timer interrupts?
Squib
Must be Steve's day off.
Hi Squib,
Well it depends on the internal oscillator type, and how you're using the interrupts.
The typical general purpose crystal will have a tolerance of +/- 50 PPM (Parts per million) Although there are other crystals with tighter tolerances, some down to less than 1 PPM. But they come at a higher cost.
If you're using one of the older 4mhz internal oscillators, depending on temperature and proper calibration numbers, they can vary up to +/-10% (100,000 PPM). A HUGE difference.
The newer 8mhz oscillators will vary a modest +/- 2.5% over the temperature range, but that's still 25,000 PPM.
If the interrupts are being used for "Long Term" timing like a clock, a difference of 1 PPM translates to an error of +/- 31.5 seconds per year. At 50 PPM it's 26.3 minutes/yr
But with the 8mhz INT_OSC, you're looking at a whopping 9.1 Days/Yr.. And with the old 4mhz osc you're off by +/-36.5 days. Yikes!
Of course these are "Worst case" numbers with maximum temperature extremes, actual results may vary.
hth,
DT
Bookmarks