Similar Problem With Comm - Rs485
Instead of starting a new thread , I thought of just adding my problems story to this one.
I am have a network of RS485 using 16F676 IC. I am having a big problem with communicating with the PC.
My harware config is :
Pin#1 of RS485 ----> MCLR/RA3
Pin#2&3 of RS485 --> RA4
Pin#4 of RS485 ---> RA5
My code is as follows:
@ DEVICE PIC16F676,INTRC_OSC_NOCLKOUT,WDT_ON,PWRT_OFF,BOD_O N,PROTECT_OFF,CPD_OFF,MCLR_OFF
Include "Modedefs.Bas"
ANSEL = 0 ' DISABLE THE ANALOG INPUT
CMCON = 7 ' DISABLE COMPARATOR ON PORTA
VRCON = 0 ' A/D Voltage reference disabled
TRISA = %00101000 ' SETS ALL PORTA PINS TO INPUT ' Set PORTAA to all input
TRISC = %00000000 ' 6 Pins - LCD and 2 Pins RF Module
LED VAR PORTC.5 ' LED (SINK)
SER_IN VAR PORTA.3 ' DATA INPUT PORT
DO VAR PORTA.5 ' DATA OUTPUT PORT
RS485 VAR PORTA.4 ' RS485 CONTROL PIN
HIGH RS485 :
' ----------------------------------------------------------------------
' ** Declare the Variables **
I VAR WORD ' TEMP VARIABLE
' ----------------------------------------------------------------------
HIGH RS485
LOOP:
FOR I = 16400 TO 16900 STEP 10
SEROUT2 DO,I,["VALUE: ", DEC I,10,13] ' FOR RS232
PAUSE 500
NEXT
GOTO LOOP
END
I seem to have lost my OSCAL value and I am trying to get a reliable comm using Hyperterminal software over RS485.
I am getting no Output on the Hyperterminal @2400
Can anyone help.
regards
Using Async Comms? Then fit a Resonator or Xtal!
In case anyone's missed it in a hundred or so previous threads...
You are NEVER going to get repeatable reliable asynchronous communications at any speed without an xtal or resonator.
You might strike lucky, or you might tear your hair out chasing your tail all because your timing is out of spec.
I've written example code at 300 baud and posted them on this forum in great confidence only to have the code fail for someone somewhere. Async comms is just plain unreliable on internal or RC oscillators.
I have an application which uses a 12F675 (internal Oscillator factory calibrated) which is little more than an Alarm Beeper. It's important to hit the resonant frequency of the Piezo for maximum sound. Now the Piezo is quite tollerant... it likes 4kHz, but is happy from 3.8kHz thru 4.2kHz. Out of every batch of 100 we build, there's always two or three PICs that don't make the grade with the Factory Cal. Now that's a dumb beeper application - and here you want precision async timing with a Factory OSCAL value?