reducing shiftout clock freq and PS2/PC interfacing ....


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1

    Question reducing shiftout clock freq and PS2/PC interfacing ....

    I'm working on a wireless optical keyboard using the PS2 caple and I'm working on it with my friends step by step and we start to try sending a single character. And through our searching we found that we need to satisfy some conditions :

    11 bit outputs , sycronous comm. with host should be done , and clock frequency with range 10KHz and 16.7KHz and the data recivied to the host ( PC ) should be read on the falling edge of the clock signal.

    ok we wrote a simple prog. using shiftout to make an " A " appears on the screen but when we make so the computer get frozen and we have to restart it from the power switch.

    and what we think is the clock freq ia the problem and we use a 4MHz osc and we don't know if we should make a pause after using the shiftout ! and how "DEFINE SHIFT_PAUSEUS 100" exactlly works !!and how it can hepl us to reduce the freq of clock and 4M => 50KHz

    and in the documents they say 50kHz depend on the osc how ??!!

    and why the computer get frozen ? and if any one worked on the connecting the Pic with the computer throgh PS2 caple please tell me if there are some point that we should take on our consideration or if there is some steps ore configrations that we might missed

    Thanks and I really nead your help to make this project !! and I'm still in the 1st step !!

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Hi all , I have some experience with PS/2 and PIC since I made interfacing between keyboard or barcode reader PS/2 and PIC microcontrollers, you may take these considrations in your work:

    1) PS/2 have two signals to communicate with it , clock and data
    2) clock generated and data sends at every falling edge of the clock
    3) each character represented with 33 bits ( make code , break code , make code)
    4) each 11 bits is consist of ( 1 start bit , 8 data bits , 1 parity bit , 1 stop bit)
    5) low level of clock duration is about 50 microsecond

    you can search on google for PS/2 keyboard interface for more specification

    I don't know the way how you use optical wireless but if you attach the schematic will be better

  3. #3


    Did you find this post helpful? Yes | No

    Exclamation

    hello iugmoh

    thanks GOD to find someone to help

    ok lets see from your points what I might have a problem with is points : 2,5

    2) clock generated and data sends at every falling edge of the clock

    ok I read this befor in a document some where but the question is how can this point implemented is there any speacial instruction that can make an affect on the clock generated from shiftout instruction ?

    OR

    does the shiftout already takes this point in the consideration ??!! oh boy this one !

    5) low level of clock duration is about 50 microsecond

    hmmm there I think it can be between 30 - 50 us but the problem how can I achive this if I use an osc = 4MHz and shiftout gives freq of clock = 50kHz

    which means low level of clock duration is about 10 microsecond , true ?!!

    so how did you solve those problems ? ( using the PICBasic )

    or should I use other IC's to help me in !!

    thanks and waiting for your replay and to see your experiance on that.

    thanks again

  4. #4
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    I am sure this link is somewhere in this forum.

    http://www.computer-engineering.org/ps2protocol/
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  5. #5


    Did you find this post helpful? Yes | No

    Unhappy

    hello sayzer

    actually I know this protocolle befor the problem how can I emplement it and make an "A"
    appears on the notepad or microsoftword using pic 16f877A

    I used shiftout ...., ..... , 5 [% 010100110/11]

    but it not working how can I control the clock frequency I want it between 10 - 16.7 KHz !

    please give me some help.

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    May be it would be much better if you write your own routine.

    You can control Clock and Data lines with more accuracy and thus play with Clock frequency as you like.

    Example:

    Code:
    <font color="#000000">        
            Temp = <font color="#FF0000"><b>$15      </b></font><font color="#000080"><i>' Send &quot;q&quot; as an example.
            
            </i></font>DatTime = <font color="#FF0000"><b>10    </b></font><font color="#000080"><i>' Data Pause Time.
            </i></font>ClkTime = <font color="#FF0000"><b>50    </b></font><font color="#000080"><i>' Clock Pause time.
            
            </i><b>OUTPUT </b></font>TxCLK    <font color="#000080"><i>' Before you send anything, assign the pins as output pins.
            </i><b>OUTPUT </b></font>TxDAT
    
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = STARTBit      <font color="#000080"><i>' Start bit is always zero.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>0        </b></font><font color="#000080"><i>' Bit 0.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
    
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>1        </b></font><font color="#000080"><i>' Bit 1.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>2        </b></font><font color="#000080"><i>' Bit 2.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>3        </b></font><font color="#000080"><i>' Bit 3.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>4        </b></font><font color="#000080"><i>' Bit 4.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime
            TxDAT = Temp.<font color="#FF0000"><b>5        </b></font><font color="#000080"><i>' Bit 5.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime        
            TxDAT = Temp.<font color="#FF0000"><b>6        </b></font><font color="#000080"><i>' Bit 6.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime        
            TxDAT = Temp.<font color="#FF0000"><b>7        </b></font><font color="#000080"><i>' Bit 7.
            </i><b>PAUSEUS </b></font>DatTime        
            TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime        
            TxDAT = Parity        <font color="#000080"><i>' Parity Bit.
            </i><b>PAUSEUS </b></font>DatTime       <font color="#000080"><i>' You must calculate Parity bit_ 
            </i></font>TxCLK = <font color="#FF0000"><b>0               </b></font><font color="#000080"><i>'in somewhere before putting it here. 
            </i><b>PAUSEUS </b></font>ClkTime
    
        
            TxCLK = <font color="#FF0000"><b>1
            </b></font><font color="#000080"><b>PAUSEUS </b></font>DatTime        
            TxDAT = StopBit       <font color="#000080"><i>' Stop bit is always 1. 
            </i><b>PAUSEUS </b></font>DatTime           <font color="#000080"><i>' Have a variable named StopBit and make it 1.
            </i></font>TxCLK = <font color="#FF0000"><b>0
            </b></font><font color="#000080"><b>PAUSEUS </b></font>ClkTime
            
            <font color="#000080"><b>INPUT </b></font>TxCLK           <font color="#000080"><i>' when you are done with sending a byte, 
            </i><b>INPUT </b></font>TxDAT              <font color="#000080"><i>'assign the pins as input pins.
    
        
    </i></font>

    This routine works fine.
    But I am having issues with different computers.
    Thus, you will have to play with Data and Clock pauses.
    Also, you will have to have a Delay between each "SEND".
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts