Finn
- 3rd February 2004, 18:56
Question:
I am fairly new to pics so please bare with me. I am using the Les Johnson program to scan the keypad(Keypad12.bas), After the keypad is scanned and the # key is pressed the following code is executed:
Define OSC 20 'Crystal is 20MHZ
Out1 VAR BYTE
Card VAR BYTE[11]
IF Key = 11 Then
Write 0,Key 'Writes Value from Key to Memory Location "0"
Read 0,Out1 'Reads Memory Location "0" and saves it as Out1
Pause 30
'SerOut PORTB.7,N2400,[#Out1] 'Sends Out1 to RS232 Transmitter ,8N1 Format
Debug I,Clr
Debug I,Line2,Clr
Debug I,Line1,"Processing" 'Prints Processing to Serial LCD Line1
Pause 3000
Debug I,Line2,"Swipe Card Now" 'Prints Swipe Card Now to LCD Line2
Pause 30
SerIn2 PORTA.4\PortA.5,16468,300,Main,[Wait ";",Ao),STR Card\11] 'Trying to read data line from Mag Card Reader
Serout PortB.5,N2400,[I,Line1,#STR Card\11] 'Trying to Print Data from Mag Card onto LCD
EndIF
After the "# "key is pressed I want to be able to read the Magnetic Card Data via A mag Card Reader: 9600/8/N/1. The data is being read from track Two in this format:
TrackID/Data/'?'.
the Track ID is ";" which is also the begin sentinel, the data follows and then the end sentinel is "?". I am trying to connect the mag card reader to the Pic16f876 and have pins 4 and 7 on the mag reader(DB9) connected to 5 volts, pin 5 to ground and Pin 3 connected to PortA.4. I cannot read the card data from the card reader. Can anyone help...maybe telling me what im doing wrong or guide me in the right direction?
Thanks in advance.
I am fairly new to pics so please bare with me. I am using the Les Johnson program to scan the keypad(Keypad12.bas), After the keypad is scanned and the # key is pressed the following code is executed:
Define OSC 20 'Crystal is 20MHZ
Out1 VAR BYTE
Card VAR BYTE[11]
IF Key = 11 Then
Write 0,Key 'Writes Value from Key to Memory Location "0"
Read 0,Out1 'Reads Memory Location "0" and saves it as Out1
Pause 30
'SerOut PORTB.7,N2400,[#Out1] 'Sends Out1 to RS232 Transmitter ,8N1 Format
Debug I,Clr
Debug I,Line2,Clr
Debug I,Line1,"Processing" 'Prints Processing to Serial LCD Line1
Pause 3000
Debug I,Line2,"Swipe Card Now" 'Prints Swipe Card Now to LCD Line2
Pause 30
SerIn2 PORTA.4\PortA.5,16468,300,Main,[Wait ";",Ao),STR Card\11] 'Trying to read data line from Mag Card Reader
Serout PortB.5,N2400,[I,Line1,#STR Card\11] 'Trying to Print Data from Mag Card onto LCD
EndIF
After the "# "key is pressed I want to be able to read the Magnetic Card Data via A mag Card Reader: 9600/8/N/1. The data is being read from track Two in this format:
TrackID/Data/'?'.
the Track ID is ";" which is also the begin sentinel, the data follows and then the end sentinel is "?". I am trying to connect the mag card reader to the Pic16f876 and have pins 4 and 7 on the mag reader(DB9) connected to 5 volts, pin 5 to ground and Pin 3 connected to PortA.4. I cannot read the card data from the card reader. Can anyone help...maybe telling me what im doing wrong or guide me in the right direction?
Thanks in advance.