08m2 countdown timer

Berny

Member
I am trying to build a countdown timer using a 08m2 and the 4 digit 7 segment display here https://learn.sparkfun.com/tutorials/using-opensegment

The code here is just trying to get the display to count up but no luck. I would post a schematic if I knew how to create one like I have seen on this site. :confused:
Right now I am using the 5v, gnd and RX pins of the display where Rx is connected to pin3 of the 08m2.

Code:
#picaxe 08m2
#no_data
#com 3
symbol tx = c.4

main:
for b0 = 0 to 10
	serout tx,n2400,(b0)
	pause 500
next b0
goto main:
 

ol boy

Member
I am trying to build a countdown timer using a 08m2 and the 4 digit 7 segment display here https://learn.sparkfun.com/tutorials/using-opensegment

The code here is just trying to get the display to count up but no luck. I would post a schematic if I knew how to create one like I have seen on this site. :confused:
Right now I am using the 5v, gnd and RX pins of the display where Rx is connected to pin3 of the 08m2.

Code:
#picaxe 08m2
#no_data
#com 3
symbol tx = c.4

main:
for b0 = 0 to 10
	serout tx,n2400,(b0)
	pause 500
next b0
goto main:
Looking at the examples on spark fun they are using 9600 baud rate not 2400.

here. https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Interface%20Specifications

Forgot this too.. https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#baud
looks like you can clear all segments and write to an individual segment.
 
Last edited:

Berny

Member
Looking at the examples on spark fun they are using 9600 baud rate not 2400.

here. https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Interface%20Specifications

Forgot this too.. https://github.com/sparkfun/Serial7SegmentDisplay/wiki/Special-Commands#baud
looks like you can clear all segments and write to an individual segment.
Changed the code to: still does not count up

Code:
#picaxe 08m2
#no_data
#com 3
setfreq m8
symbol baud = t9600_8
symbol tx = c.4

for b0 = 0 to 10
	serout tx,baud,(b0)
	pause 500
next b0
end
 

ol boy

Member
from the examples in spark fun you need to send several serout commands to get it going.

serout 118 to clear the display I converted all the hex values to dec.
serout 123 for digit #1
serout (b0)

you might not have to clear the display for each time you update the same segment.
 

Pongo

Senior Member
I think it'll need you to send ascii characters for the numbers so try (#b0) instead of (b0).

I would also suggest you send the command to set the baud rate and send a reset command as suggested in the docs linked by ol boy. Also check out the information in picaxe manual 2 for serout about setting the serial output pin high when using the "T" baud rate option.
 

Berny

Member
something must be defective

I am still unable to get this display to work. In fact I cannot get it to do anything to the display. Attached is the latest code which does nothing. When powered up the display shows 1 2 3 4 and does not change. It seems something is defective and I am guessing it is me :(
I have tried all the possible pins out of the 08m2 and none of them have any effect.
I am wondering now if I should be using the JST connector pins instead of the side pins. The Arduino picture shows using the side pins?

Thanks for all the help so far. Any ideas would still be appreciated. Below is the latest code.

#picaxe 08m2
#no_data
#com 3
setfreq m8
symbol tx = c.4
symbol baud = n9600_8
high tx
pause 20
serout tx, baud , (#118) 'clears display
serout tx, baud , (123) 'digit 1
end
 

Hemi345

Senior Member
Try
Code:
#picaxe 08m2
#no_data
#com 3
setfreq m8
symbol tx = c.4 'this is connected to RX on display
symbol baud = n9600_8
pause 1000 'wait 1/2 second
serout tx, baud, (129) 'reset display to factory defaults
pause 1000 'wait 1/2 second
serout tx, baud, (118) 'clear display
pause 20 'wait 10ms
serout tx, baud, (1) 'display '1' in left most digit
pause 2000 'wait 1 second
serout tx, baud, (2) 'display '2' in 2nd digit from left
end
Did you try the reset feature of the display: https://learn.sparkfun.com/tutorials/using-opensegment/factory-reset
 
Last edited:

Berny

Member
still not responding

Yes, I did try the factory reset. I copied your code and ran it. Nothing changes. I have tried the "dim" command with no success. The display responds to nothing

Try
Code:
#picaxe 08m2
#no_data
#com 3
setfreq m8
symbol tx = c.4 'this is connected to RX on display
symbol baud = n9600_8
pause 1000 'wait 1/2 second
serout tx, baud, (129) 'reset display to factory defaults
pause 1000 'wait 1/2 second
serout tx, baud, (118) 'clear display
pause 20 'wait 10ms
serout tx, baud, (1) 'display '1' in left most digit
pause 2000 'wait 1 second
serout tx, baud, (2) 'display '2' in 2nd digit from left
end
Did you try the reset feature of the display: https://learn.sparkfun.com/tutorials/using-opensegment/factory-reset
I just sent an email to Sparkfun technical support regarding my problem. I appreciate everyone's help. Maybe someday I will be as helpful as all of you. I will let you know hat I hear in 2-3 business days. In the meantime I am still open to any comments any/all of you may have. Thanks, Berny
 
Last edited:

Berny

Member
small progress

Yes, I did try the factory reset. I copied your code and ran it. Nothing changes. I have tried the "dim" command with no success. The display responds to nothing



I just sent an email to Sparkfun technical support regarding my problem. I appreciate everyone's help. Maybe someday I will be as helpful as all of you. I will let you know hat I hear in 2-3 business days. In the meantime I am still open to any comments any/all of you may have. Thanks, Berny
Tech support sent the message below which actually worked as stated however, the problem still remains. Guess I now need to ask a question I should have asked first. I am using this https://www.sparkfun.com/products/8321 and perhaps I am using the wrong pin. I am assuming the numbers listed on the board, 01234, are actually c.0,c.1,c.2,etc. I have changed my code to use pin 0. Is this correct?

"Try connecting RX to ground with the power off and then powering up the display. You will see alternating "____" and "----" then a rotating "0-00" display indicating that the baud rate is now at 9600. You can now release the RX pin from ground, and the display will continue to function normally."

Code:
#picaxe 08m2
#no_data
#com 3
setfreq m8

symbol tx = c.0 'this is connected to RX on display
symbol baud = T9600_8

high tx
serout tx, baud, (0x7F)
serout tx, baud, (0x02)
pause 1000 'wait 1/2 second
'serout tx, baud, (0x81) 'reset display to factory defaults
pause 1000 'wait 1/2 second
serout tx, baud, (0x76) 'clear display
pause 20 'wait 10ms
main:
serout tx, baud, (0x7B) 'display '1' in left most digit
serout tx, baud, ("9876")
pause 2000 'wait 1 second
serout tx, baud, (0x7C) 'display '2' in 2nd digit from left
serout tx, baud, ("1236")
serout tx, baud, (0x7D,0000)
serout tx, baud, (0x7E,0000)
goto main:
Can't remember how to encapsulate code

Pat
 
Last edited by a moderator:

hippy

Technical Support
Staff member
Tech support sent the message below which actually worked as stated however, the problem still remains... I have changed my code to use pin 0. Is this correct?
That would seem to be correct, and you may also have to change the baud rate to T9600_8 - it looks like N9600_8 has been used in some of the code posted earlier.

To insert code in postings, wrap that in [code]...[/code] tags.
 

Berny

Member
Countdown timer working

I apologize for the delay. I have the countdown timer working to my satisfaction. Thanks for all the help! pberns
 
Last edited:
Top