Reading Magnetic Card on Pic16f876
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.
Reading Magnetic Card on Pic16f876
Thank you Melanie, I am checking it out now...Appreciate your response.
Magnetic Card and Pic16f876 (PicBasicPro)
Melanie,
I have a question on the Mag reader card hookups in your source code. Which pin is considered the clock pin on the DB9 Config and which is considered the card loaded and running signal. The pins I have hooked up are Pin 3(TX) Pin5(GRD)
Pin4(DTR) to +5volts With 1,2,6,7,8 and 9 disconnected.
Thanks,
Reading Magnetic Card on Pic16f876
I checked through the datasheet and found pins I think I can use. For the Running and loaded signal im going to use DTR, or a constant 5 volts and the TX Pin for data. I was looking through you code and it seems that the program is ready to execute and recieve data when the clock signal is low, So maybe I can just set that pin to low and have it work? Also the data is coming in at 9600bps, which i imagine is the same as your "bare" reader. Is there a Define needed for the data rate?
Thanks,