Home     Contact     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science     RSS     Terms of services     Privacy policy  
   
 Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science   

Author Topic: Help  (Read 4738 times)

0 Members and 1 Guest are viewing this topic.

FelIX

  • Guest
Help
« on: March 05, 2008, 00:51:32 AM »
Hallo all. Nice to join your community!

before i kill my self, please help me. I try to send data to PS2 port of pc. i use the following code.

Code: [Select]
;**************************************************************************
;*********     SEND DATA THROUGH PS/2 PORT        *************************
;**************************************************************************
SendDataOnW
        movwf TempBuffer
        movwf ByteToSend
        call WaitTransmit
        movlw 0x8
        movwf Counter
        movlw 0x0
        movwf Parity
StartSending
        bcf HostData                ;start bit
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit

SendnextBit
        rrf ByteToSend,f
        btfss carry
        goto BitIs0
BitIs1       
        incf Parity,f
        bsf HostData
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit
        goto BitWasSent       
BitIs0
        bcf HostData
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit
BitWasSent
        decf Counter,f
        btfsc zero
        goto EndTransmitData
        goto SendnextBit

EndTransmitData
        ;Send Parity Bit
        rrf Parity,w
        btfsc carry
        goto Parity0
Parity1
        bcf HostData                ;Parity (odd=1)
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit
        goto SendEndBit
Parity0
        bsf HostData                ;Parity (odd=0)
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit
SendEndBit
        bsf HostData                ;stop bit=1
        bcf HostClock
        call WaitTransmit
        bsf HostClock
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit


        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit
        call WaitTransmit


        return

WaitTransmit
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        nop
        return

Why oh Why does not function?

Please help!  :'( :'( :'( :'(

kam

  • Administrator
  • Hero Member
  • *****
  • Posts: 1849
Re: Help
« Reply #1 on: March 05, 2008, 08:15:59 AM »
What exactlt happens? Do you have any clue?

FelIX

  • Guest
Re: Help
« Reply #2 on: March 05, 2008, 23:09:39 PM »
Nothing. Really nothing. And i have double check this piece of code.

How can i debug it? Is there any way?

FelIX

  • Guest
Re: Help
« Reply #3 on: March 05, 2008, 23:10:55 PM »
I mean, i have some output, i check it with an led on output pin and i see it blink momentarily which means there is some kind of output but the computer receives not corect word.

How can i see what outputs the pic?

Alex

  • Guest
Re: Help
« Reply #4 on: March 06, 2008, 01:50:23 AM »
You may debug it by simply make it do somethind different for a while.

For example, make it light leds (that you put temporarily to it's exits) and see what exactly it transmits

Thre are several ways but i prefer the leds.

FelIX

  • Guest
Re: Help
« Reply #5 on: March 06, 2008, 21:02:04 PM »
I think i found it. It was an rrf that should be rlf. But i almost brake my head to find it.
Thank all

kam

  • Administrator
  • Hero Member
  • *****
  • Posts: 1849
Re: Help
« Reply #6 on: March 07, 2008, 16:28:18 PM »
Anytime mate!  ;)