Il problema, è che non riporta i valori dei condensatori, dei diodi del cristallo e una resistenza. Ho provato a contattarlo, ma non mi ha mai risposto. Poi Anche lo schema della ps2,non mi torna proprio, troppi pin da collegare, cosa che l'attacco ps2 non ha. Ora al di la del connettore, c'è un modo per capire i valori che mi mancano?
il progetto che hai postato richiede la programmazione di un microprocessore, tu sei in grado di farlo?
Dalla tua presentazione, non credo.
Visto che dici di essere inesperto, come puoi pensare di realizzare un progetto così difficoltoso?
Ti conviene, prima, studiare, e parecchio, imparare a programmare, attrezzarti e poi ci pensiamo.
SPQR
postato il: 22.12.2014, alle ore 16:13
I pic so programmarli, eventualmente stasera quando torno a casa, mando un video mentre lo faccio ok? Detto questo ,ora è possibile avere qualche idea sul da farsi?
Jasson
postato il: 22.12.2014, alle ore 17:40
I diodi, sono semplici diodi, quindi va bene qualsisia tipo di diodo, esempio un 1n4148 o 1n4007.
C1 normalmente nemmeno si mette, puoi provare con 100nf dovrebbero andare bene.
R1 è detta resistenza di pullup. e va bene qualsiasi valore compreso tra 1k e 10k
I condensatori c2 e c3 dipendono dal valore del quarzo utilizzato, ma con un valore di 15pf o 22pf non dovresti avere problemi di funzionamento.
Il problema sorge con il cristallo, il suo valore con il pic 16f877 può essere 2Mhz( difficile) 4Mhz, 8mHz o 16Mhz.
Il problema è che tale valore viene scritto pure nelle impostazioni all'interno del pic, quindi l'unico che può dirti che valore è stato utilizzato nel progetto, è colui che ha progettato il tutto.
Quindi o colui che ha realizzato il progetto, ti dice che valori utilizzare, o altrimenti puoi anche provare per tentativi.
SPQR
postato il: 22.12.2014, alle ore 19:20
Dentro il file zip nel sito , c'è l'hex e l'asm.. Da li si rimedia qualcosa ?
Jasson
postato il: 22.12.2014, alle ore 20:00
SPQR: Dentro il file zip nel sito , c'è l'hex e l'asm.. Da li si rimedia qualcosa ?
Credo di si, se qualcuno è in grado di decifrare l'asm, magari ti saprà dire che quarzo è stato impostato.
SPQR
postato il: 22.12.2014, alle ore 20:58
; Keyboard Encoder
;
; Written by:Steven Easley
; Email: seasley@robotdungeon.com
; Webpage: www.robotdungeon.com
;
;
;
list p=16f877a ; list directive to define processor
#include <P16f877A.INC> ; processor specific variable definitions
errorlevel -302
;Define the port data
#DEFINE KB_DATo PORTA,0
#DEFINE KB_CLKo PORTA,1
#DEFINE KB_DATi PORTA,2
#DEFINE KB_CLKi PORTA,3
#DEFINE stallr_a PORTA,5
#DEFINE scan_enable PORTB,7
#define KB_ERROR 0xFE
cblock 0x20
temp ;misc scratch byte
counter ;used in the SPI routines
; Used by the PS2 keyboard routines
parity
kb_data
host_data
RX_error
KB_init
wait_counter
temp0
; RAM to hold the current and last button states
portA_mirror
portA_last
portB_mirror
portB_last
portC_mirror
portC_last
portD_mirror
portD_last
portE_mirror
portE_last
;Delay variables
d1
d2
d3
endc
org 0x0000
goto init
org 0x0004
goto ISR
ISR
bcf INTCON, GIE ; disable interrupts
bcf INTCON, INTF
bsf INTCON, GIE ; enable interrupts
retfie
movlw 0x08 ;Count 8 rising edges
movwf counter
movlw 0xFF
clrf wait_counter
Start_bit:
decfsz wait_counter, f
goto here0
retlw 0xFE
here0:
btfsc KB_CLKi ;Wait for clock to go low
goto Start_bit
btfsc KB_DATi ;Is start bit low
retlw 0xFE ;If not exit with error
movlw 0xFF
clrf wait_counter
Wait_Start_bit:
decfsz wait_counter, f
goto here1
retlw 0xFE
here1:
btfss KB_CLKi ;Wait for clock to go high
goto Wait_Start_bit
RX_data:
decfsz wait_counter, f
goto here2
retlw 0xFE
here2:
btfsc KB_CLKi ;Wait for clock to go low
goto RX_data
;Data is valid when clock is low
bcf STATUS, C
btfsc KB_DATi
bsf STATUS, C
rrf kb_data,f
movlw 0xFF
clrf wait_counter
Wait_RX_data:
decfsz wait_counter, f
goto here3
retlw 0xFE
here3:
btfss KB_CLKi ;Wait for clock to go high
goto Wait_RX_data
movlw 0xFF
clrf wait_counter
decfsz counter, f
goto RX_data
movlw 0xFF
clrf wait_counter
Parity_bit:
decfsz wait_counter, f
goto here4
retlw 0xFE
here4:
btfsc KB_CLKi ;Wait for clock to go low
goto Parity_bit
clrf parity ;Check and record parity
btfsc KB_DATi
incf parity, f
movlw 0xFF
clrf wait_counter
Wait_Parity_bit:
decfsz wait_counter, f
goto here5
retlw 0xFE
here5:
btfss KB_CLKi ;Wait for clock to go high
goto Wait_Parity_bit
movlw 0xFF
clrf wait_counter
Stop_bit:
decfsz wait_counter, f
goto here6
retlw 0xFE
here6:
btfsc KB_CLKi ;Wait for clock to go low
goto Stop_bit
movlw 0xFF
clrf wait_counter
Wait_Stop_bit:
decfsz wait_counter, f
goto here7
retlw 0xFE
here7:
btfss KB_CLKi ;Wait for clock to go high
goto Wait_Stop_bit
bsf STATUS, RP0 ;pull data low and release clock
bcf KB_DATi
bsf KB_CLKi
bcf STATUS, RP0
RX_data0:
btfsc KB_CLKi ;Wait for clock to go low
goto RX_data0
;Data is valid when clock is high
movf temp0, w
xorwf parity, f
bsf STATUS, RP0
andlw 0x01
btfss STATUS, Z
bsf KB_DATi
btfsc STATUS, Z
bcf KB_DATi
bcf STATUS, RP0
rrf temp0, f
RX_data1:
btfss KB_CLKi ;Wait for clock to go high
goto RX_data1
decfsz counter, f
goto RX_data0
Parity_bit0:
btfsc KB_CLKi ;Wait for clock to go low
goto Parity_bit0
;**********************************************************
; Initialize all the ports and stuff
init
; bank 0
bcf STATUS, RP0 ;Goto the right page
;Setup default port states
movlw b'00000000'
movwf PORTA
movlw b'00000000'
movwf PORTB
movlw b'00000000'
movwf PORTC
movlw b'00000000'
movwf PORTD
movlw b'00000000'
movwf PORTE
;Disable A2D
movlw b'00000000' ; Setup A2D on all portA pins and set osc. bits
movwf ADCON0
; bank 1
bsf STATUS, RP0 ; Goto the right page
;Setup the data direction registers
movlw b'11111111' ; Set portA to all inputs
movwf TRISA
movlw b'11111111' ; Set SPI port to inputs
movwf TRISB
movlw b'11111111' ; Set RX pin to input all oters output
movwf TRISC
movlw b'11111111' ; Set SPI port to inputs
movwf TRISD
movlw b'00000111' ; Set RX pin to input all oters output
movwf TRISE
;Disable the A2D
movlw b'00000110' ; Setup A2D right justified
movwf ADCON1
bcf STATUS, RP0 ;Goto the right page
bcf INTCON, GIE ; Disable interrupts
call Delay_500ms
movlw 0xAA
call Send_host
; keyboard and host
; H K
; AA
; FF FA
; AA
; ED FA
; 00 FA
; FF FA
; AA
; F3 FA
; 00 FA
; ED FA
; 00 FA
; ED FA
; 00 FA
; F3 FA
; 20 FA
; Button Maping
; PA4 => a => P2_RIGHT => KEYCODE_G
; PA5 => b => P2_DOWN => KEYCODE_F
; PB0 => c => P1_BUTTON5 => KEYCODE_Z
; PB1 => d => P1_COIN => KEYCODE_5
; PB2 => e => P1_START => KEYCODE_1
; PB3 => f => P1_DOWN => KEYCODE_DOWN
; PB4 => g => P1_RIGHT => KEYCODE_RIGHT
; PB5 => h => P1_UP => KEYCODE_UP
; PB6 => i => P1_LEFT => KEYCODE_LEFT
; PC0 => k => P2_BUTTON2 => KEYCODE_S
; PC1 => l => P2_BUTTON3 => KEYCODE_D
; PC2 => m => P2_BUTTON4 => KEYCODE_W
; PC3 => n => P2_START => KEYCODE_2
; PC4 => o => P2_BUTTON6 => KEYCODE_Y
; PC5 => ESC
; PC6 => q => P1_BUTTON4 => KEYCODE_LSHIFT
; PC7 => r => P1_BUTTON3 => KEYCODE_SPACE
; PD0 => s => P2_COIN => KEYCODE_6
; PD1 => t => P2_BUTTON5 => KEYCODE_T
; PD2 => u =>
; PD3 => v => P2_BUTTON7 => KEYCODE_A
; PD4 => w => P1_BUTTON2 => KEYCODE_LALT
; PD5 => x => P1_BUTTON1 => KEYCODE_LCONTROL
; PD6 => y => P1_BUTTON7 => KEYCODE_LCONTROL
; PD7 => z => P1_BUTTON6 => KEYCODE_X
; PE0 => 0 => P2_LEFT => KEYCODE_D
; PE1 => 1 => P2_UP => KEYCODE_R
; PE2 => 2 => P2_BUTTON1 => KEYCODE_A
;--------------------------------------------------------------------
;Start of the main program, aka were it all goes down.
;--------------------------------------------------------------------
clrf KB_init
main:
btfss scan_enable
goto Skip_delay
call delay_1ms
call delay_1ms
call delay_1ms
call delay_1ms
call delay_1ms
Skip_delay:
;Check to see if keyboard wants to talk
btfsc scan_enable
goto PC_to_device
call Receive_device
sublw KB_ERROR
bz PC_to_device
;Forward data to PC
movf kb_data, w
call Send_host
movf KB_init, w
sublw 0x00
bz state0
movf KB_init, w
sublw 0x01
bz state1
goto PC_to_device
state0:
;First reset the keybord
call delay_1ms
movlw 0xFF
call Send_device
incf KB_init, f
goto PC_to_device
state1:
;Second send the ED command
movlw 0xED
call Send_device
show_error:
movf RX_error, w
sublw 0xFE
bz check_inputs
call delay_50ms
movf RX_error, w
goto main
check_inputs:
btfss scan_enable
goto main
;Scan the keys for presses and releases
;Check the buttons that are on PORTA<--------------------
CheckA:
movf PORTA, w
andlw 0x30;
movwf portA_mirror
xorwf portA_last, w
bz CheckB
Come utente anonimo puoi leggere il contenuto di questo forum ma per aprire una discussione
o per partecipare ad una discussione esistente devi essere registrato ed accedere al sito