I want to interface PS2 with pic16f877a i have seen my link in Google but i am suck with code how to do this...the ps2 has been tested in terminal window it was sending different ascii/hex number for different keys.
please tell for half duplex communication i.e. Device to Host.
i was trying using this..
Code:
unsigned char Data=0,temp;
while(CLK==0); //Wait for First Falling Edge
for(char i=0;i<7;i++)
{
while(CLK==0); //Capture the next 7 bits of data
temp=RC0;
temp<<=i;
Data|=temp;
}
For testing code i have connected two switch on board for clk and data rather than connecting ps2 it self..but the serial window does not show the data enter from switch as i want...at while it wait for clk to 0 for starting and after 0 it run for loop ....then the process go on unnecessary.
1 start bit. This is always 0.
8 data bits, least significant bit first.
1 parity bit (odd parity).
1 stop bit. This is always 1.
OK, i need one suggestion for making a up-down counter for led rate list board...
up to 3 digit. i will use 7447 to save uC port terminal.
with up switch down and reset.
if(sw1==1){
unsigned int counter;
counter =counter+1;
then
PORTB=counter; // 8 bit i.e. 2 digit will
for getting upper 4 bit of counter
what should i do, for getting it in another port?
i have done i think it will work fine as in MPsim...
Code:
void main (void){//program for counter for rate list
TRISB=0X00;
TRISC=0b11110000;
PORTB=0X00;
PORTC=0X00;
while(1){
unsigned int count;
unsigned int count1;
PORTB=count;
count1=count;
count1>>=8;//shift to get upper bit of int
PORTC=count1;
if(RC7==1){ //incremment counter
__delay_ms(50);
count=count+1;
}
if(RC6==1){//decrement counter
__delay_ms(50);
count=count-1;
}
if(RC5==1){ //reset to zero
__delay_ms(200);
count=0;
}
}
}
I need some help....for making up counter...i am using upper bits of PRTB connected to 7447 i want to remove cont above >9 but the cond is not working as shown in code ...please tell why?
Code:
while(1){
PORTB=count;
if((RD1==1)){ //incremment counter
__delay_ms(20);//debounce
RC5=0;
if(count<9){// this is not working why?? with cond it is working?????
count++;
}
}
Unfortunately, it seems that you have chosen the wrong career. Programming and all does not sit well with you. That is why you are battling with everything.
Kindly remember, later on in life, ETO will not always be here to bail you out when you need to provide answers to your employer when things you built/designed don't work properly. No ETO to ask for help....just the guy paying your huge salary looking at you wanting answers.
Rather do what I did. Accept the fact that there are certain things that I am useless at....acknowledge it and move on. Don't try to force yourself to do stuff that you are incapable of understanding......properly. Properly being the important thing here.
I have solved the problem of counter but now i want to save the result after power off, i have used const but showing error because i am modifing it...please tell how to do this i have used internal E2PROM before can't we do anything else?