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.
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 ?
Yes it will. The MAX232 has an internal pull-down on the R1in side of the inverter http://www.rentron.com/Files/bMAX232.gifI 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?
I did some tests with that chip and also using a rs485 chip to test. You talked about rs232 and a direction (TX_ENABLE) and when I look at the code I think it's RS485, but that is not an issue.
I also discovered that indeed the chip will not startup when using HSERIN and the RX pin of the uart is high.
I put a 10K resistor from the RX pin of the picchip to ground and now the program is starting up normaly.
I hope it will help you.
Bookmarks