View previous topic :: View next topic |
Author |
Message |
Ivar Johnsrud Guest
|
Is it possible to read a constante as high and low byte? |
Posted: Tue Nov 12, 2002 12:11 pm |
|
|
Does anyone know if it is possible to read a
constant as high and low byte, something like this:
#define COUNT 0x10FF
#asm
movlw HIGH COUNT
movwf TMR0H
movlw LOW COUNT
movwf TMR0L
#endasm
-Ivar
___________________________
This message was ported from CCS's old forum
Original Post ID: 8808 |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
Re: Is it possible to read a constante as high and low byte? |
Posted: Tue Nov 12, 2002 12:31 pm |
|
|
:=Does anyone know if it is possible to read a
:=constant as high and low byte, something like this:
:=
:=#define COUNT 0x10FF
:=
:=#asm
:= movlw HIGH COUNT
:= movwf TMR0H
:= movlw LOW COUNT
:= movwf TMR0L
:=#endasm
:=
:=-Ivar
This may be what you are looking for.
set_timer0(COUNT);
___________________________
This message was ported from CCS's old forum
Original Post ID: 8810 |
|
|
Ivar Johnsrud Guest
|
Re: Is it possible to read a constante as high and low byte? |
Posted: Tue Nov 12, 2002 12:33 pm |
|
|
:=:=Does anyone know if it is possible to read a
:=:=constant as high and low byte, something like this:
:=:=
:=:=#define COUNT 0x10FF
:=:=
:=:=#asm
:=:= movlw HIGH COUNT
:=:= movwf TMR0H
:=:= movlw LOW COUNT
:=:= movwf TMR0L
:=:=#endasm
:=:=
:=:=-Ivar
:=
:=This may be what you are looking for.
:=
:=set_timer0(COUNT);
:=
Yeah, I just realized, thanks.
-Ivar
___________________________
This message was ported from CCS's old forum
Original Post ID: 8812 |
|
|
Sherpa Doug Guest
|
Also check out MAKE8() |
Posted: Tue Nov 12, 2002 12:50 pm |
|
|
___________________________
This message was ported from CCS's old forum
Original Post ID: 8813 |
|
|
johnpcunningham Guest
|
Re: Is it possible to read a constante as high and low byte? |
Posted: Tue Nov 12, 2002 1:31 pm |
|
|
<font face="Courier New" size=-1>Another idea for you (like a UNION) using 16F877:
//register locations
#byte TMR1L 0x0E
#byte TMR1H 0x0F
void main(){
int16 timer1_long;
//get 16 bit value of timer
timer1_long = make16(TMR1H, TMR1L);
//set timer values
TMR1L = 0xAA;
TMR1H = 0xBB;
while(1){};
}</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 8814 |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: Is it possible to read a constante as high and low byte? |
Posted: Tue Nov 12, 2002 3:05 pm |
|
|
Yet another way....
using 16F877:
long TMR1;
#locate TMR1 = 0x0E
#define TIMERVALUE 0xAA55
void main(void)
{
TMR1 = TIMERVALUE;
while(1)
{
}
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 8816 |
|
|
|