Hello everyone,
I have these two lines of code:
Dim Timer1 As TMR1L.AsWord <<<<<< see how this one is correct
Dim Timer0 As TMR0L.asword <<<<<< see this one is all lower case.
Does that mean the the var timer0 won't hold the full 16 bit value?
The pic I am using is a 18F1220. Timer0 is selectable as a 16bit or two 8 bit timer/counter. I have it selected as a 16 bit counter. Thanks.
need some more help!
Moderators: David Barker, Jerry Messina
need some more help!
Running version 2.2.4.0 ICC 1.2.1.0
Regards CharlieM
Regards CharlieM
See if this alternative method works.
Code: Select all
Dim Timer0 as word
Dim Timer1 as word
Timer0 = (TMR0H<<8)+TMR0L
Timer1 = (TMR1H<<8)+TMR1L
I've not had a problem with upper / lower case.
Someone corect me if I've got this wrong but I thought there was a problem with Swordfish and using Timer0 in 16bit mode. When writing to TMR0 you need to write the high byte first and when reading from TMR0 you need to read the low byte first. Writing is fine as Swordfish will write the high byte first but if you do this:
Then the generated assembler will read the high byte first which will give the wrong result.
Is this an issue or have I made it up?
Someone corect me if I've got this wrong but I thought there was a problem with Swordfish and using Timer0 in 16bit mode. When writing to TMR0 you need to write the high byte first and when reading from TMR0 you need to read the low byte first. Writing is fine as Swordfish will write the high byte first but if you do this:
Code: Select all
Dim Timer0 As TMR0L.AsWord
Dim WordValue As Word
WordValue = Timer0
Is this an issue or have I made it up?
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US