Bcd help
Archiver
Posts: 46,084
CAN SOMEONE SHOW ME HOW TO MAKE THIS COUNT CORRECTLY IT STOPS AT BCD VALUE
OF 99 OR DEC VALUE OF 153 I JUST CAN'T GET IT TO ROLL OVER TO BCD 100 OR DEC
160. I need to go from 0 to 399 this is used in interfacing the Icom or
Optoelectronics CI-V interface.
'{$STAMP BS2}
L VAR WORD
BCD VAR WORD
BCD1 VAR BCD.HIGHBYTE
BCD0 VAR BCD.LOWBYTE
start:
FOR L=95 TO 399
BCD =(L DIG 0)+((L DIG 1)*16)
pause 1000
debug DEC BCD.HIGHBYTE,DEC BCD.LOWBYTE,13
NEXT
OF 99 OR DEC VALUE OF 153 I JUST CAN'T GET IT TO ROLL OVER TO BCD 100 OR DEC
160. I need to go from 0 to 399 this is used in interfacing the Icom or
Optoelectronics CI-V interface.
'{$STAMP BS2}
L VAR WORD
BCD VAR WORD
BCD1 VAR BCD.HIGHBYTE
BCD0 VAR BCD.LOWBYTE
start:
FOR L=95 TO 399
BCD =(L DIG 0)+((L DIG 1)*16)
pause 1000
debug DEC BCD.HIGHBYTE,DEC BCD.LOWBYTE,13
NEXT
Comments
Start:
FOR decVal = 0 TO 399
bcdVal = ((decVal DIG 2) << 8) + ((decVal DIG 1) << 4) + (decVal DIG 0)
DEBUG DEC3 decVal, TAB, HEX3 bcdVal, CR
PAUSE 100
NEXT
END
It's a little cleaner to use the Left-Shift ( << ) operator for your
conversion.
-- Jon Williams
-- Parallax
In a message dated 1/6/02 5:04:11 PM Central Standard Time,
lgaminde@t... writes:
> CAN SOMEONE SHOW ME HOW TO MAKE THIS COUNT CORRECTLY IT STOPS AT BCD VALUE
> OF 99 OR DEC VALUE OF 153 I JUST CAN'T GET IT TO ROLL OVER TO BCD 100 OR DEC
> 160. I need to go from 0 to 399 this is used in interfacing the Icom or
> Optoelectronics CI-V interface.
>
> '{$STAMP BS2}
> L VAR WORD
> BCD VAR WORD
> BCD1 VAR BCD.HIGHBYTE
> BCD0 VAR BCD.LOWBYTE
>
> start:
> FOR L=95 TO 399
> BCD =(L DIG 0)+((L DIG 1)*16)
> pause 1000
> debug DEC BCD.HIGHBYTE,DEC BCD.LOWBYTE,13
> NEXT
>
[noparse][[/noparse]Non-text portions of this message have been removed]
I needed the jump in numbers every 10, 10 = 16 and I used the highbyte and
lowbyte because I had two byte size addresses to send to. All seams to be
working at this time, I will load it up with frequencies and test it out.
larry gaminde
Original Message
From: <jonwms@a...>
To: <basicstamps@yahoogroups.com>
Sent: January 06, 2002 4:36 PM
Subject: Re: [noparse][[/noparse]basicstamps] BCD HELP
| Try this ...
|
|
| Start:
| FOR decVal = 0 TO 399
| bcdVal = ((decVal DIG 2) << 8) + ((decVal DIG 1) << 4) + (decVal DIG
0)
| DEBUG DEC3 decVal, TAB, HEX3 bcdVal, CR
| PAUSE 100
| NEXT
|
| END
|
|
| It's a little cleaner to use the Left-Shift ( << ) operator for your
| conversion.
|
| -- Jon Williams
| -- Parallax
|
|
|
| In a message dated 1/6/02 5:04:11 PM Central Standard Time,
| lgaminde@t... writes:
|
|
| > CAN SOMEONE SHOW ME HOW TO MAKE THIS COUNT CORRECTLY IT STOPS AT BCD
VALUE
| > OF 99 OR DEC VALUE OF 153 I JUST CAN'T GET IT TO ROLL OVER TO BCD 100 OR
DEC
| > 160. I need to go from 0 to 399 this is used in interfacing the Icom or
| > Optoelectronics CI-V interface.
| >
| > '{$STAMP BS2}
| > L VAR WORD
| > BCD VAR WORD
| > BCD1 VAR BCD.HIGHBYTE
| > BCD0 VAR BCD.LOWBYTE
| >
| > start:
| > FOR L=95 TO 399
| > BCD =(L DIG 0)+((L DIG 1)*16)
| > pause 1000
| > debug DEC BCD.HIGHBYTE,DEC BCD.LOWBYTE,13
| > NEXT
| >
|
|
|
|
| [noparse][[/noparse]Non-text portions of this message have been removed]
|
|
| To UNSUBSCRIBE, just send mail to:
| basicstamps-unsubscribe@yahoogroups.com
| from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
|
|
| Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|
|