mailus
Full Member level 4
- Joined
- Mar 6, 2012
- Messages
- 234
- Helped
- 7
- Reputation
- 16
- Reaction score
- 7
- Trophy points
- 1,308
- Location
- -
- Activity points
- 2,706
My Requirements,
i am using pic microcontroller
i have 9 inputs, output-1,display 7 segment-1(single segment).
read input from PORTC and RA0_pin.
if rc0_bit low means the display show as 1,
if rc0_bit and rc5_bit low means the display show 1 and 6 at a particular interval,
similarly for each and every combination of input the display must show the corresponding output.
i designed a program but i need to develop in different way
my program:
i am using pic microcontroller
i have 9 inputs, output-1,display 7 segment-1(single segment).
read input from PORTC and RA0_pin.
if rc0_bit low means the display show as 1,
if rc0_bit and rc5_bit low means the display show 1 and 6 at a particular interval,
similarly for each and every combination of input the display must show the corresponding output.
i designed a program but i need to develop in different way
my program:
Code:
void main()
{
adcon1=0x06;cmcon=0x06;
TrisA=0x01;TrisB=0x00;TrisC=0xff;
porta=0x00;portb=0x00;portc=0x00;
read_input,x=0;
do
{
read_input=portc^0xff;
if(read_input==0)
{
x=0;
control(x);
portb=0x3f;
}
if(RC0_bit==0)
{
x=1;
control(x);
portb=0X06;
delay_ms(1000);
}
if(RC1_bit==0)
{
x=2;
control(x);
portb=0X5b;
delay_ms(1000);
}
if(RC2_bit==0)
{
x=3;
control(x);
portb=0X4f;
delay_ms(1000);
}
if(rc3_bit==0)
{
x=4;
control(x);
portb=0X66;
delay_ms(1000);
}
if(rc4_bit==0)
{
x=5;
control(x);
portb=0X6d;
delay_ms(1000);
}
if(rc5_bit==0)
{
x=6;
control(x);
portb=0X7d;
delay_ms(1000);
}
if(rc6_bit==0)
{
x=7;
control(x);
portb=0X07;
delay_ms(1000);
}
if(rc7_bit==0)
{
x=8;
control(x);
portb=0X7f;
delay_ms(1000);
}
delay_ms(100);
}while(1);
}
Last edited: