Computer Science Canada

7 segment display

Author:  stas054 [ Thu Jun 11, 2009 3:29 pm ]
Post subject:  7 segment display

What is it you are trying to achieve?
Hello everyone, I am making a test program with ultiple choice questiongs that works from a joystick I made.


What is the problem you are having?
I am having a problem with programming 7 segment display, it supposed to work as a countdown from 9 to 0 but it just puts random numbers and I don't get how it works exactly, can somebody explain to me? or give me a sample code for countdown on 7 segment from 9 to 0 using parallelput?


Describe what you have tried to solve this problem
I tried pretty much everything I found even putting something like parallelput(22) and it actually gave me numbers but I don't get the pattern




Turing:


%display functions
%0
parallelput (1)
parallelput (2)
parallelput (4)
parallelput (16)
delay (1000)

%1
parallelput (2)
parallelput (4)
parallelput (16)
delay (1000)

%2
parallelput (1)
parallelput (4)
parallelput (16)
delay (1000)

%3
parallelput (4)
parallelput (16)
delay (1000)

%4
parallelput (1)
parallelput (2)
parallelput (16)
delay (1000)


%5
parallelput (2)
parallelput (16)
delay (1000)

%6
parallelput (1)
parallelput (16)
delay (1000)


%7
parallelput (16)
delay (1000)

%8
parallelput (1)
parallelput (2)
parallelput (4)
delay (1000)

%9
parallelput (2)
parallelput (4)
delay (1000)





Please specify what version of Turing you are using
4.1.1

Author:  Tony [ Thu Jun 11, 2009 3:39 pm ]
Post subject:  RE:7 segment display

read the docs on parallelput. In brief, with parallelput(22), you are not putting 22, but the binary string that 22 represents 0010110 -- match up 7 bits to your 7 segments, and you should figure out the patterns that will draw digits on the screen.

Author:  stas054 [ Thu Jun 11, 2009 3:53 pm ]
Post subject:  Re: 7 segment display

I got it now... but... I am only using 4 outputs so that would be 0000 for 0 0001 for 1, 0010 for 2 and so on, but it doesnt seem to work =/

Author:  stas054 [ Thu Jun 11, 2009 3:54 pm ]
Post subject:  Re: 7 segment display

I mean it works but I am getting random numbers not the ones I need

Author:  stas054 [ Thu Jun 11, 2009 4:09 pm ]
Post subject:  Re: 7 segment display

this is what I did

Turing:
parallelput(6)
delay(1000)
parallelput(7)
delay(1000)
parallelput(8)
delay(1000)
parallelput(9)
delay(1000)
parallelput(10)
delay(1000)
parallelput(11)
delay(1000)
parallelput(12)
delay(1000)
parallelput(13)
delay(1000)
parallelput(14)
delay(1000)
parallelput(15)
delay(1000)


but it doesn't work properly =(

Author:  Tony [ Thu Jun 11, 2009 4:18 pm ]
Post subject:  RE:7 segment display

what do you mean it doesn't work properly? What do you expect to be the proper result, and how is the observed behaviour different?

Author:  stas054 [ Thu Jun 11, 2009 4:21 pm ]
Post subject:  Re: 7 segment display

well it starts with 9 and then it displays random parts of the 7 seg... I don't understand why it does that if I look at the theory I have done everything correctly...

Author:  stas054 [ Thu Jun 11, 2009 4:22 pm ]
Post subject:  RE:7 segment display

i want it to count... 9...8...7...6...5...4...3...2...1...

Author:  stas054 [ Thu Jun 11, 2009 4:28 pm ]
Post subject:  RE:7 segment display

nvm I got it thanks xD


: