void main()
{
     TRISA=0x00;
     TRISB=0x00;
while(1)
{
     PORTB=0x06;
     PORTA=0x01;
     delay(10);
     PORTB=0x5B;
     PORTA=0x02;
     delay(10);
     PORTB=0x4F;
     PORTA=0x04;
     delay(10);
     PORTB=0x66;
     PORTA=0x08;
}
}

This a few program that i make in creating a scoreboard for basketball using PIC 16f84a..Is this program correct??

Recommended Answers

All 7 Replies

How is this a scoreboard? Correct me if I'm wrong, but it looks to me that this program just makes a number of outputs 'high' with a delay of 10 (sec/msec??) Where is the delay function because it isn't standard so you probably wrote it (or 'found' it).
How do you change the output? In other words: where do you read anything?
Change void main() to int main() that's the way it's defined.

p.s. Please use code tags in your next posts

Looks like you are looking forward to interface LCD display (presuming that would serve the purpose of a scoreboard) using PIC microcontroller.

Please, in such projects, you need to be very very specific with the hardware connections that you've made. Also, specify the exact nature of the display you want (i.e. what you want to display when). After all, that would help us in helping you ;).

> Is this program correct??
No.
For a basketball scoreboard, don't you need things like
- the amount of time played, or the time left.
- the score for each team.
- a means of updating the score for each team (press one of two buttons say).
- other buttons to say start/stop the clock for timeouts, reset the clock for the next period of play, maybe even adjust the time at the referees discretion.

As niek_e and Jishnu have pointed out, you need to show us exactly how all your hardware is wired up, what kind of display device (7-segment LED, dot-matrix LCD, or whatever) and anything else specific to your implementation. Your code might do something, but it doesn't read any input, and the output doesn't seem to vary.

If you're using some off the shelf development board, then telling us what that is would definitely help.

> Change void main() to int main() that's the way it's defined.
Actually, this would qualify as a "free-standing" implementation, so anything goes, so long as you read the documentation.

Looks like there are four 7-segments being mutiplexed together.
PORTB sends the data out to the 7-segment selected in turn by PORTA with a slight delay between each.

I have no experience with C programming on PICs so I can't say if the program is right. Does it compile?.

A quick look at the pinout though says you have only one input pin left. If I'm right about the wiring you also have one of port B's pins unused which I imagine you would have to make an input if you want to do things like, select the team's score to increment and by how many points etc.

That piece of code just keeps in reating the same thing again and again for ever. I mean it just displays the same thing. U will have to update something as the game goes along. So you will have to get some input from a particular source.

And have u tried compiling and running that program. I guess u are using some 16bit complier.

ssharish

sorry for the late reply because I'am to busy with may study..our speak give that program to us..its a program,a running program but it is in incresing from..I would like to change it into decreasing form so that me and may group can create our design as a manual digital scoreboard....

We are using 7 segment LED display,because our teacher wants us to use that..we have the schematic part of the scoreboard but the only thing that we cannot solve is the program of it using PIC16f84a in C....

sorry for the inconvince...I'am a new in this PIC that we are using...Sorry....Thanks for any help that any one can help..........

Attach the schematic here then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.