PDA

View Full Version : SERIN2/RFID code won't run ?



fowardbias
- 6th April 2008, 07:12
I can't get my code to step passed SERIN2. The DEBUG and SEROUT2 commands work good to the MCS. The 18F4620 was used first and then back to the 16F877A. The results are the same. All the configs. are OK and I have moved the SERIN2 input to different pins ( TTL and ST inputs) on both chips. A scope check of the data taken at the input pin of the PIC shows it to be correct ( $0A and the first three digits of the tag number) The reader is the Parallax RFID unit and it will work on the BS2 platform. Data is 8N1. The PASS TAG NOW makes it to the screen and thats it. Here is the read part of the 877 code:

'GENERAL DEFINES
DEFINE OSC 4
DEFINE SER2_BITS 8

'DEBUG DEFINES
Define DEBUG_REG PORTC
DEFINE DEBUG_BIT 0
DEFINE DEBUG_BAUD 2400
DEFINE DEBUG_MODE 1
DEFINE DEBUG_PACING 100

'VARIABLES
BUF var BYTE(10)
IDX VAR BYTE
RX VAR PORTA.2

'INITIALIZATION
HIGH PORTA.1 'READER OFF
PAUSE 3000 'INITIALIZATION TIMING

'PROGRAM CODE
MAIN:
LOW PORTA.1 'READER ON (RED LED ON)
PAUSE 1000
DEBUG "PASS TAG NOW",13,10
SERIN2 RX, 396, [WAIT($0A), STR BUF\10] 'DATA FROM RFID TO PIC
PAUSE 100
HIGH PORTA.1 'READER OFF (GREEN LED ON)
PAUSE 250
DEBUG "TAG IDENTIFICATION NUMBER IS:",13,10 'SEND THIS HEADER
FOR IDX = 0 TO 9
DEBUG BUF(IDX) 'DEBUG TAG NUMBER
NEXT
PAUSE 3000
GOTO MAIN:

skimask
- 6th April 2008, 07:25
Port A on a 16F877A...
What's special about Port A?
What is it about Port A and it's pins and it's functions that makes it different than most other pins on the PIC16F877A or the PIC18F4620?
What is it?
Maybe that's it's got Analog capabilities that some other pins don't have?
I don't know...could be...might not be...

fowardbias
- 6th April 2008, 07:41
CCP2CON=00000000 'COMPARATORS OFF
TRISA=0000100 'PORTA = OUTPUTS EXCEPT RA2 IS AN INPUT
TRISB=00000000 'PORTB = OUTPUTS
TRISD=00000000 'PORTD = OUTPUTS
TRISC=00000000 'PORTC = OUTPUTS

More SETUP included

mister_e
- 6th April 2008, 08:52
Tip: ADCON1... CMCON

fowardbias
- 6th April 2008, 16:15
Added lines no help same results.

fowardbias
- 6th April 2008, 17:05
Moved to RB0 and everything is running great. I thought I had the AD's and Compars off, may be not.? Senior brain pause? Spring? anything but stupid.Thanks.

mackrackit
- 6th April 2008, 17:34
Read this
http://www.picbasic.co.uk/forum/showthread.php?t=561