Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Interfacing a PS/2 Touchpad with a 16F628A

Status
Not open for further replies.

Smartie

Member
Interfacing a PS/2 Touchpad with a 16F628A (check it out!)

Hey guys,

just let you know that i have made a library that lets me interface a PS/2 touch pad on my 16F628A.

Atm, the source code to it isn't available but some time tomorrow I'll clean up the code and put it into a zip file on my site for you guys to download.

anyway check it out:
https://www.davevaughan.com/roman/projects.php?p=6

update:
Okay, i have just cleaned up the code and wrote a read me file and zipped them up for you guys to try. Please comment on what you think :)

Cheers
Roman
 

Attachments

  • touchpad.zip
    4 KB · Views: 93
Last edited:

Smartie

Member
quick question for you "experts"

i converted this function:
Code:
void send_tp_arg(byte arg) {
    byte i;
    for (i = 0; i < 4; i++){
        PS2_send(0xE8);
        PS2_send((arg >> (6-2*i)) & 3);
    }
}

into this:
Code:
PS2_send_tp_arg	;sends b'10110100' as b'00000010',b'00000011',b'00000001' and b'00000000';
	movwf	PS2_tp_arg
	movwf	PS2_tp_arg2
	movlw	0xE8
	call	PS2_send
	
	movlw	0x06
	movwf	PS2_COUNTB
tp_l1
	rrf		PS2_tp_arg2,F
	decfsz	PS2_COUNTB,F
	goto	tp_l1
	movfw	PS2_tp_arg2
	andlw	0x03
	call	PS2_send
	movfw	PS2_tp_arg
	movwf	PS2_tp_arg2
	
	movlw	0xE8
	call	PS2_send
	movlw	0x04
	movwf	PS2_COUNTB
tp_l2
	rrf		PS2_tp_arg2,F
	decfsz	PS2_COUNTB,F
	goto	tp_l2
	movfw	PS2_tp_arg2
	andlw	0x03
	call	PS2_send
	movfw	PS2_tp_arg
	movwf	PS2_tp_arg2
	
	movlw	0xE8
	call	PS2_send
	movlw	0x02
	movwf	PS2_COUNTB
tp_l3
	rrf		PS2_tp_arg2,F
	decfsz	PS2_COUNTB,F
	goto	tp_l3
	movfw	PS2_tp_arg2
	andlw	0x03
	call	PS2_send
	movfw	PS2_tp_arg
	movwf	PS2_tp_arg2
	
	movlw	0xE8
	call	PS2_send
	movfw	PS2_tp_arg2
	andlw	0x03
	call	PS2_send
	return
I'm not too sure if that's the best that can be done, do you guys think i did good there?
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top