HSERIN2 is only used for chips with two hardware serial ports/This is the program code. the hserin2 is only used. I'm using a 20Mhz OSC.
HSERIN2 is only used for chips with two hardware serial ports/This is the program code. the hserin2 is only used. I'm using a 20Mhz OSC.
Dave
Always wear safety glasses while programming.
OOPPSS
Maybe this???
The pins of the AUSART module are multiplexed with
the functions of PORTG (RG1/TX2/CK2 and
RG2/RX2/DT2, respectively). In order to configure
these pins as an AUSART:
• bit SPEN (RCSTA2<7>) must be set (= 1)
• bit TRISG<2> must be set (= 1)
• bit TRISG<1> must be cleared (= 0) for
Asynchronous and Synchronous Master modes
Dave
Always wear safety glasses while programming.
Hi Beginner,
One thing to check is the port's idle state. HSER* requires the port to idle HIGH so you will need a pull up resistor or the port will likely hang the program.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Joe,
Thanks for the heads up on that, but most of the samples I've come across have something like
If the pins are tied high then this will cause the code to constantly loop to the sections that deal with the comms. would it not be better to tie the pins to ground via resistors ?Code:IF RCIF THEN GOSUB xxxxx or IF RCIF=1 THEN GOSUB xxxxx
The USART RX pin should definitely idle high, but this routine has some major issues;
K = 240, but your largest array variables are only 6 bytes. I.E. buffero(0) to buffero(5) would be the last byte available in your buffero array.Code:BEGIN: For K = 240 TO 240 ' <-- BIG problem here teller = teller + 1 ADRESS = K AANTAL = 1 buffero(K) = teller ' <-- there is no buffero(240) GoSub WEGSCHRIJVEN PauseUs 200 ADRESS = K AANTAL = 1 GoSub OPHALEN IF OK = 1 Then lcdbufO(K) = bufferi(K) ' <-- same issue here LCDBUFI(K) = BUFFERO(K) ' <-- and here GoSub LCD OK = 0 GoTo HIER1 EndIF LCDBUFO(K) = 0 LCDBUFI(K) = 0 GoSub LCD HIER1: Next
Uhmm... just looked at the schematic in the EasyPIC5 manual, the RX line is connected direct to the R1Out pin on the Max232 - the TX pin to the T1in pin which is tied to Vcc via 1K resistor. I assume the MAX232 will handle the logic level of the RX pin ?
I tried to change the For K = 240 TO 240 to For K = 0 TO 5 , but it does not make any difference.
The chip still keeps running VERY slow (like 25 seconds startup time) when I'm using the HSERIN command.
---------------------
The RS232 schematic is ok, I'm using the same for other PCB's with 16f887 and 16f882 chips where it works fine.
----------------------
Also changing the bit TRISG<2> = 1 does not solve this problem.
Any more suggestions?
Bookmarks