16f877 and ps/2 keyboard error???


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Angry 16f877 and ps/2 keyboard error???

    Hi! I have been trying to make an interface between 16f877 and ps/2 keyboard but although I have connected the data and clk pins to PB.7 and PB.6 , I cannot see anything on my glcd.
    Should I connect these pins with any pullup resistors from 5V or what shoud I do ??
    I'm writing my codes below.. Pls help me!
    Thans A Lot....


    Code:
    		Include "PROTON18_452.BAS" 
    Device 16F877
    		WARNINGS = OFF        
          
    
     TRISB=%0110000    
    Symbol  Giris  PORTB.6 
    Symbol  Clk    PORTB.5 
    Dim dur As Bit 
        Dim ComingData As Byte 
        Dim B0 As Byte 
        Dim xpos As Byte 
        Dim ypos As Byte 
        Dim OKU As Byte 
        Dim ADRS As Word 
        Dim TEKRAR As Word 
        Dim ARRAY1[9] As Byte 
        Cls
       BEGIN: 
    Dim i As Word 
    For i = 0 To 10 Step 1  '11 bitlik veri gelecek 
    
    While Clk =1    ' Ilk önce Clock=1 olmali 
    Wend            
    
    If i<9 & i>0 Then 
    ARRAY1[i]=ComingData 
    EndIf 
    
      
    While Clk = 0 
    Wend 
    
    While Clk = 0 
    Wend 
    
    Next 
    
    Cls 
    Print At 2,2, Str ARRAY1 
    DelayMS 500 
    
    GoTo BEGIN
        
        
        
    
       
    End
        Include "FONT.INC"
    second part of the code for initalize GLCD ... There isn't any error..


    Code:
    ' PROTON board for 16 series device
    ' Operating on 4MHz.
    ' Using a GRAPHIC LCD with an internal FONT
    
    Device 16F877
            XTAL 4
            TRISB=%11010000
            TRISA=%00000110
            PORTB=0
            LCD_DTPORT = PORTD
    		LCD_RSPIN = PORTC.1
    		LCD_ENPIN = PORTE.0  
    		LCD_RWPIN = PORTC.0  
            LCD_CS1PIN = PORTE.1
    		LCD_CS2PIN = PORTE.2
            LCD_TYPE = GRAPHIC
    		INTERNAL_FONT = On
    		FONT_ADDR = 0
            
    		SDA_PIN = PORTC.4
    		SCL_PIN = PORTC.3
    
    		SERIAL_BAUD = 2400	
    		RSOUT_PIN = PORTC.6
    		RSOUT_MODE = TRUE
    		RSOUT_PACE = 1
    		RSIN_PIN = PORTC.7
    		RSIN_MODE = TRUE
            
            HSERIAL_BAUD = 2400		' Set baud rate to 2400
            HSERIAL_RCSTA = %10010000       ' Enable serial port and continuous receive
            HSERIAL_TXSTA = %00100100       ' Enable transmit and asynchronous mode 
            HSERIAL_CLEAR = On		' Enable Error clearing on received characters
            
    		'KEYPAD_PORT = PORTB
            CCP1_PIN = PORTC.2
    		CCP2_PIN = PORTC.1
            
    		Symbol T300 = 3313	NO_LIST
    		Symbol N300 = 3313 + $4000	NO_LIST
    		Symbol T600 = 1646	NO_LIST
    		Symbol N600 = 1646 + $4000	NO_LIST
    		Symbol T1200 = 813	NO_LIST
    		Symbol N1200 = 813 + $4000	NO_LIST
    		Symbol T2400 = 396	NO_LIST
    		Symbol N2400 = 396 + $4000	NO_LIST
    		Symbol T4800 = 188	NO_LIST
    		Symbol N4800 = 188 + $4000	NO_LIST
    		Symbol T9600 = 84	NO_LIST
    		Symbol N9600 = 84 + $4000 NO_LIST
        
    		Symbol OT2400 = 396 + $8000	NO_LIST       ' Open True
    		Symbol OT1200 = 813 + $8000	NO_LIST       ' Open True
    		Symbol OT9600 = 84 + $8000	NO_LIST      ' Open True
    		Symbol OT300  = 3313 + $8000	NO_LIST      ' Open True
    
    		Symbol ON2400 = 396 + $4000 + $8000	NO_LIST      ' Open Inverted
    		Symbol ON1200 = 813 + $4000 + $8000	NO_LIST      ' Open Inverted
    		Symbol ON9600 = 84 + $4000 + $8000	NO_LIST      ' Open Inverted
    		Symbol ON300  = 3313 + $4000 + $8000 	NO_LIST     ' Open Inverted
    
    ' Rsout / Serial Constants
    		Symbol HOME = 1	NO_LIST
    		Symbol BELL = 7	NO_LIST
    		Symbol BKSP = 8	NO_LIST
    		Symbol TAB = 9	NO_LIST
    		Symbol CR = 13	NO_LIST
            
            ALL_DIGITAL = True	' Set PORTA and PORTE to all digital

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default M E Labs vs Proton

    Hi boraciner, The project looks interesting, but this forum uses M E Labs PBasic not Proton, here is the link to the Proton Forum. I would be interested in following your project there, if you would do us the favor of posting a link in this thread to the new one you post there it would be appreciated. http://www.picbasic.org/forum/
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Jul 2009
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    I have already opened a topic in that website, but no one answered..
    If you're interested in, we can share our knowledge; I have a few robotics projects in my website : www.dreamrobotics.com
    Secondly, My msn : [email protected] If you add me your contacts, we can communicate each other ...

    Thanks a lot..

Similar Threads

  1. PS/2 keyboard emulation
    By CumQuaT in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th September 2009, 04:32
  2. pic as ps/2 keyboard
    By mischl in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 15th May 2007, 16:53
  3. PS/2 mouse and keyboard
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2006, 16:29
  4. My wish: AT Keyboard and Mouse commands
    By sayzer in forum PBP Wish List
    Replies: 0
    Last Post: - 4th February 2006, 08:23
  5. PAK-V1a PS/2 coprocessor
    By srob in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th October 2005, 13:00

Members who have read this thread : 1

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