Displaying numbers

hi this isnt really to do with robots but it is building something with electronics so i thought i'd ask here because i know the users are friendly and someone will probably be able to help me.

so my friend wanted to build a scaletrix track and he's cutting some wood and thats all fine but we are trying to work out how to make a lap counter for multiple lanes. we decided to use picaxe because thats all we really know how to do. so far we have decided on an arch across the track with infra red emmiters and in each slot (it is slot car racing) there will be a hole containing a infra red sensor. the car goes through breaks the beam sort of and the picaxe starts timing. one picaxe per lane so at the end the picaxe chips will know the time for their respective lanes. to keep cost down we hope to be using an 08m if possible to keep the cost down. anyway so the problem is we need some way of displaying the times.

i thought of using the program processing so we could show time difference and positions but i have no idea how to use it (dont bother trying to explain here but if yuo know somewhere that would be able to teach me how to use it with picaxe then that would be great)

so seven segment displays we thought of but they need loads of outputs and using picaxes thet have enough would cost a lot

so a seriallcd display but some one would have to change the wire between the chips to display each timeunless you got one for each lane which again would cost a lot unless they were non serial but agin we have no idea how to use them

so basicly it comes down to lack of knowledge or budget

thanks for reading all this and if you have any ideas or could tell me what you think my best bet is please answer below

thanks 

Drive 7 Segment Display with a Shift Register

Actually 7 segment displays are cool for this kind of usage. Yes this 7 segment indicator has 7 input-pins (look at the picture below). But all of them are digital.

So if you use a shift register like the 74HC595 the number of pins you use from the microcontroller (your picaxe) is reduced to 3 (look at the second image below). And this stays 3 even if you add a second indicator or more.

Here some information about the shift register and it’s wiring. Don’t bother that it is an Arduino site. The wiring is the same what ever microcontroller you use.

On ebay you find one shift register for around 1$. The 74HC595 is around 1/4$. After all this is a cheap solution and fun to make. 

ShftOutExmp1_3.gif

 

How many lanes?

If you have only, say 4 lanes, you could get away with a single picaxe and then serial out from the chip to display. If you are using a micro, you could even display lap times, if you had a big enough display. I would suggest stepping up to a bit larger PICAXE and just use a single chip to power the lap/time display, rather than individual chips per lane. You could even put your display on your overpass.

Just a thought but perhaps

Just a thought but perhaps some hall effect sensors could be used under each lane to detect the magnets of the cars passing by?

You can use a max7219 that

You can use a max7219 that can control up to 8 digits and only requires few lines for control : http://tronixstuff.wordpress.com/2010/07/09/review-maxim-max7219-led-display-driver-ic/ .

I never used a picaxe but if i have to do this with an another micro i would use an interrupt on every car passes and a free runnig timer.

1 picaxe?

hi thanks for all you replies 

in reply to birdmun i originally wanted to use one picaxe but when one car passes wouldn’t it have to stop timing the others whilst it goes through the start new lap time sub script because it would need another variable for each lap time.

if i’m talking giberish please tell me

Search for CMOS 4026

Search for CMOS 4026 7-segment-display driver IC. Picaxe manual 3, page 22.

programming for a shift register

to NilsB

i looked around for help with programming the picaxe with a shift register

there were plenty of sites but none of them said “what this example would do” and is just a load of for next loops

do you, or anyone for that matter, know a site that could help me with this

 

In my opinion if you want to

In my opinion if you want to record for example 4 lanes you should connect the sensor to 4 pin that have an interrupt and then in a interrupt routine of a timer you check if a car passed, if yes you start to increment a variable until the car passed another time, then you reset the variable and restart.

 

You want to display numbers.

You want to display numbers.

Is it that you understand how to wire the shift register chip to your Picaxe - but not how to write Picaxe code that lets you display this numbers?

Hello ducksrule,

I saw your post and I might have something that is usefull for you, recently i “came across” :slight_smile: a 4 x 7 segment display that one can control with 8 pins: 4 Pins for Display Selection and 4 Pins to send the numbers you want to show (I used a 7447 BCDto7Seg Disp Driver), and a Picaxe 28X2:

230520122717.jpg

The "trick" is to use a timing of 5 micro secs between sending a number and to the desired display.. Basically  the displays are flashing, but it's all so fast that one sees the numbers "always", not flashing.. :p (I think the 4th transistor is not working wery well, that's why the 4th digit light's up weaker, even if the other 3 display's are off.., but that's another story :p ) If it help's I'm glad to post the schematic and code.

yes

nilsb

thats right

 

Using 7-Segment Displays with the PICAXE Micro-Controller

Here is a documentation that shows how to program the number display using Picaxe and a shift register.

Does this walkthrough make the programming understandable for you?

sort of

that helped me to understand it a little bit but i’m not sure why lighting up a certain sequence of leds can be described as 0x3f also how this can be transfered to a simple variable.nor do i understand how i would go about displaying 1 number on the display without the sequence or transfering it to ram. then i’m not sure what LOW Bit_out does

so basicly:

how does one know what 0x77 thingy each segment pattern relates to

how that is made into a variable

how one sends th 0x77 thingy to the shift register

so although this has given me more of an overall understanding,which i thank you for, i still don’t quite get it

 

I will attempt to help here.

; store display code in user RAM

poke 50,0x3f ;0 dec 63
poke 51,0x06 ;1 dec 6
poke 52,0x5b ;2 dec 91
poke 53,0x4f ;3 dec 79
poke 54,0x66 ;4 dec 102
poke 55,0x6d ;5 dec 109
poke 56,0x7d ;6 dec 125
poke 57,0x07 ;7 dec 7
poke 58,0x7f ;8 dec 127
poke 59,0x67 ;9 dec 103
poke 60,0x77 ;A dec 119
poke 61,0x7c ;b dec 124
poke 62,0x39 ;C dec 57
poke 63,0x5e ;d dec 94
poke 64,0x79 ;E dec 121
poke 65,0x71 ;F dec 113
poke 66,0x80 ;dp dec 128

These POKEs are actually placing values in RAM positions. Later in the program on that page you will see PEEK, that reads from specific positions. His values for each number are dependent on how he connected each LED pin to the shift register.
In the second program he changed the HEX values to DEC; 63,6,91,79,102,109,125,7,127,103,119,124,57,94,121,113. They map to
the same output of 0 through F and then decimal point.

Bit_out, CLK, and CLR are pins labeled on the shift register. The way his loop is set up it uses a BYTE to turn on the required LEDs to display a particular number. He connected the decimal point to Q0, so, he masks the decimal point to keep it from appearing unless he wants it to with temp = val & %00000001 ;mask all bits except first.

I will attempt a visual aid, if I need to.

Transfer Ascii-Code through the Shift Register to the 7-Segment

The 0x notation indicates that you are using hexadecimal numbers. In this case the hex is an ascii code. In the ascii code you find the alphabet and all numbers and some special characters.

Basically the code puts some ascii codes into the Picaxe’s registers 50 to 66. Then in the loop it peeks each ascii code. 

Having one ascii code (let’s use the character for the number 4) the program goes on and transfers this code to the 7-segment display via shift register. To do that the program uses a for-loop that goes from 0 to 7 to shift out each bit of the ascii code. If the ascii code is 0x34 the binary looks like this 00110100. Each bit must now be transfered to the shift register. It shifts out (from right to left) the first 0, then 0, then 1, then 0, then 1, 1, 0 and then 0. Now all 8 bits are serially shifted into the register.

Now the program must change the latch pin to HIGH to let the shift register know that it can expose these values ( 00110100 ) to the out pins of the shift register. Now the 7-segment displays a 4.

Now use the code, the breadboard sketch and this explanations (including Birdmuns comment) and try it out. Order the parts if this is the the solution to your initial question. Soon you have a nice number display for your race course.

You could also follow MarkusB’s hint and use a special chip to achieve the same thing as we here make from scratch.

63?

i get it a lot more nox (thanks ) but whay is 0 with a deccimal point 63 because surely that it %00111111 which is al lights except 2

but if u light up a 0 with a decimal point then that is only 1 led that is not turned on?

 

 

DEC 63 will show a 0 because,

temp = val & %00000001 ;mask all bits except first.

If val = 63 or %00111111 then when you get to the above line temp = %00111111 & %00000001. Which means, temp = 1 and the decimal point will be turned off by:

if temp = 1 then LOW Bit_out else HIGH Bit_out endif

now

now

 

next digit

birdmun

ok forget what i just said for a moment. if what you said is true then when the next digit is sent to the shift register whay is that not just turned off too