Problem with a problem
I have a problem. In fact, I have two problems.
The first problem is tht I have a problem. The second problem is that I'm
not sure I can explain my problem.
I am running a DS1302 on a BS2E, which is working fine. I want to display
hrs:mins on a 4-digit display driven by a 595. This means I have to sent one
digit at a time to the 595.
Time on the 1302 is formatted as HEX2. If the time is 12:XX and I debug
HEX2 hrs then I get 12. I need to send "12" to the 595 one digit at a time.
How do I extract first the "1" and then the "2". DIG n doesn't work - if I
write
debug ? hrs dig 1, I get 15, which is the decimal equivalent of the 1 in
$12.
Any suggestions?
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
The first problem is tht I have a problem. The second problem is that I'm
not sure I can explain my problem.
I am running a DS1302 on a BS2E, which is working fine. I want to display
hrs:mins on a 4-digit display driven by a 595. This means I have to sent one
digit at a time to the 595.
Time on the 1302 is formatted as HEX2. If the time is 12:XX and I debug
HEX2 hrs then I get 12. I need to send "12" to the 595 one digit at a time.
How do I extract first the "1" and then the "2". DIG n doesn't work - if I
write
debug ? hrs dig 1, I get 15, which is the decimal equivalent of the 1 in
$12.
Any suggestions?
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
jwilliams@p... writes:
> Main:
> test = $12
> DEBUG DEC test.HIGHNIB, CR
> DEBUG DEC test.LOWNIB
> END
>
OK - so it works !!!
Now I have to get it in a form I can send to a 595.
Can I say
hrs1 var byte
hrs2 var byte
hrs1 = hrs.highnib and
hrs2 = hrs.lownib then
shiftout pin, baud, lsbfirst, [noparse][[/noparse]hrs1]
OR
hr1 var hrs.highnib
hr2 var hrs.lownib
shiftout pin, baud, lsbfirst, [noparse][[/noparse]hr1\8]
Since hr1 is now a nib, won't it have to be padded to a byte?
Did you get everything off to Jeff?
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
alw@a... writes:
> Sure. Say the value is X. Try this:
>
> Digit1 = X>>4
> Digit2 = X&$F
>
> Won't that work?
>
>
Hi, Al
Yep, that works.
X>>4 is same as highnib
X&$F is same as lownib
I wish I was as smart as you and Jon and Tracy.
Sid
[noparse][[/noparse]Non-text portions of this message have been removed]
jwilliams@p... writes:
> Easy.
>
You always say that [noparse]:)[/noparse])
[noparse][[/noparse]Non-text portions of this message have been removed]
theDigit = hours.HIGHNIB
After this, theDigit will be set to 1. Send it.
theDigit = hours.LOWNIB
After this, theDigit will be set to 2. Now send it.
To prove that I'm not lying, run this program:
test VAR Byte
Main:
test = $12
DEBUG DEC test.HIGHNIB, CR
DEBUG DEC test.LOWNIB
END
There ... all problems solved! [noparse];)[/noparse]
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=3Pq8JL0xrqMwZa-0fueTm-8IxMleaSmV2bms49AOqgylEressJ94vMkbQDIgnqNgxzShggnjAis]Newzed@a...[/url
Sent: Tuesday, July 06, 2004 1:22 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Problem with a problem
I have a problem. In fact, I have two problems.
The first problem is tht I have a problem. The second problem is that
I'm
not sure I can explain my problem.
I am running a DS1302 on a BS2E, which is working fine. I want to
display
hrs:mins on a 4-digit display driven by a 595. This means I have to
sent one
digit at a time to the 595.
Time on the 1302 is formatted as HEX2. If the time is 12:XX and I debug
HEX2 hrs then I get 12. I need to send "12" to the 595 one digit at a
time.
How do I extract first the "1" and then the "2". DIG n doesn't work -
if I write
debug ? hrs dig 1, I get 15, which is the decimal equivalent of the 1
in
$12.
Any suggestions?
Sid
[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.
Yahoo! Groups Links
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Sure. Say the value is X. Try this:
Digit1 = X>>4
Digit2 = X&$F
Won't that work?
Regards,
Al Williams
AWC
* Add Floating point math, PWM, pulse I/O and more to your Stamp
http://www.awce.com
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=mNo6yj8RIGI2rR1ZousUyAXE9OI0Ss_xQpwR7zNL_M9E4tLiTag-2OZ_OSIuYhV5Y8sb1Ukbvw]Newzed@a...[/url
Sent: Tuesday, July 06, 2004 1:22 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Problem with a problem
I have a problem. In fact, I have two problems.
The first problem is tht I have a problem. The second problem is that I'm
not sure I can explain my problem.
I am running a DS1302 on a BS2E, which is working fine. I want to display
hrs:mins on a 4-digit display driven by a 595. This means I have to sent
one
digit at a time to the 595.
Time on the 1302 is formatted as HEX2. If the time is 12:XX and I debug
HEX2 hrs then I get 12. I need to send "12" to the 595 one digit at a time.
How do I extract first the "1" and then the "2". DIG n doesn't work - if I
write
debug ? hrs dig 1, I get 15, which is the decimal equivalent of the 1 in
$12.
Any suggestions?
Sid
[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.
Yahoo! Groups Links
And you don't have to declare \8 (for eight bits) in your SHIFTOUT as
that is the default size. In fact, if you have your 595s daisy-chained
and want to put one digit in each, you can do this:
SHIFTOUT Dpin, Cpin, MSBFIRST, [noparse][[/noparse]hrs.LOWNIB, hrs.HIGHNIB]
The low nibble will end up in the second '595 in the chain, the high
nibble in the first (the one closest to the BASIC Stamp). Since there is
not bits declaration, the BASIC Stamp will clock out eight bits for
each.
Easy.
Jon Williams
Parallax
PS: Yes, everything made it to Jeff. Thanks again.
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=rqWCC9oF4cBDir3aMNZnOeDQhfHKXedQ42WnJZW-5IqLm7pvlJQSXnn655gD21tk1-wCy5ZS-A]Newzed@a...[/url
Sent: Tuesday, July 06, 2004 2:18 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Problem with a problem
In a message dated 7/6/2004 2:35:20 PM Eastern Daylight Time,
jwilliams@p... writes:
> Main:
> test = $12
> DEBUG DEC test.HIGHNIB, CR
> DEBUG DEC test.LOWNIB
> END
>
OK - so it works !!!
Now I have to get it in a form I can send to a 595.
Can I say
hrs1 var byte
hrs2 var byte
hrs1 = hrs.highnib and
hrs2 = hrs.lownib then
shiftout pin, baud, lsbfirst, [noparse][[/noparse]hrs1]
OR
hr1 var hrs.highnib
hr2 var hrs.lownib
shiftout pin, baud, lsbfirst, [noparse][[/noparse]hr1\8]
Since hr1 is now a nib, won't it have to be padded to a byte?
Did you get everything off to Jeff?
Sid
Jon
Original Message
From: Newzed@a... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=-3lULCSgGnqAz3KKFqZtbbesxWh9X09vPteGBZ49hKTniI9RWPc7tTMypxxrjc2D6OaJzZarYGnc]Newzed@a...[/url
Sent: Tuesday, July 06, 2004 4:20 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] Problem with a problem
In a message dated 7/6/2004 5:15:09 PM Eastern Daylight Time,
jwilliams@p... writes:
> Easy.
>
You always say that [noparse]:)[/noparse])