helllllllllo eveybody
i have this project where the use of ps2 mouse is required and i am having real problem interfacing it to the micro, i am using the 16f877a.
the clock of the ps/2 is pulled high by a pull-up resistor and connected to the external interrupt pin B0.
the data pin is connected to pin D2 and also pulled high
now i am able to monitor the signal using the pickit2, when the mouse is powered up it sends 0xAA 0x00 bytes, i am able to confirm that. here is the img
**broken link removed**
the problem is when i try read the signal using the microcontroller i faild, even when simply just trying to count the clock pulses at PIN B0 during mouse power up
the output of the code:
pulses: 1
where it should be 22 i belive
here is what i tried to do :
- remove the pickit2 while the pic is doing its job trying to count them pulses
- remove the pullup resistors
- enable/disable portb weak pull ups
- re-enable the ext_int at the ISR
- simulating with protues isis gives correct result !!!
i dont know whats wrong + ive been trying to solve it for 2 days so any suggestions are highly appreciated !!
thanks for reading.
i have this project where the use of ps2 mouse is required and i am having real problem interfacing it to the micro, i am using the 16f877a.
the clock of the ps/2 is pulled high by a pull-up resistor and connected to the external interrupt pin B0.
the data pin is connected to pin D2 and also pulled high
now i am able to monitor the signal using the pickit2, when the mouse is powered up it sends 0xAA 0x00 bytes, i am able to confirm that. here is the img
**broken link removed**
the problem is when i try read the signal using the microcontroller i faild, even when simply just trying to count the clock pulses at PIN B0 during mouse power up
Code:
#int_EXT
void EXT_isr(void)
{
pulses++;
}
.
.
.
void main()
{
pulses = 0;
.
.......PIC initialization code.........
.
ext_int_edge( H_TO_L ); //track high to low transitions on pin
enable_interrupts(INT_EXT);// enable external interrupt
enable_interrupts(GLOBAL);
set_tris_b(0xff);
while(true)
{
printf("pulses: %u\r\n",pulses);
delay_ms(500);
}
}
the output of the code:
pulses: 1
where it should be 22 i belive
here is what i tried to do :
- remove the pickit2 while the pic is doing its job trying to count them pulses
- remove the pullup resistors
- enable/disable portb weak pull ups
- re-enable the ext_int at the ISR
- simulating with protues isis gives correct result !!!
i dont know whats wrong + ive been trying to solve it for 2 days so any suggestions are highly appreciated !!
thanks for reading.