program Mouse Dim aX as integer Dim aY as integer Dim sX as integer Dim sY as integer Dim But as byte main: TRISB = 0 PORTB = 0 TRISC = 255 Usart_Init(9600) ANSEL = %00000111 lop: aX = Adc_Read(0) aY = Adc_Read(1) sX = aX >> 2 sY = aY >> 2 But = %11111000 If TestBit(PORTC, 0) = 1 then But = But OR %00000001 end if If TestBit(PORTC, 1) = 1 then But = But OR %00000010 end if If TestBit(PORTC, 2) = 1 then But = But OR %00000100 end if Usart_Write(But) Usart_Write(sX) Usart_Write(sY) delay_ms(10) goto lop end.