Thanks for answer.
I use the same code with PIC16F876 and works fine.
The problem is only on PIC18F525, and is verry random (never in the same point).
I will tay to explain better what I wont to have from my code:
A lot of numbers are saved on EEPROMs, when the acquisition are stoped I need to transfer this numbers on PC. I do this with Hserout. The Pic read the EEPROM and send this numbers to PC. I need to read, on my PC software, the same lengt of caracters, if the lenght of string are difrent I have a lot of errors, and missing data.
This problem of incomplete string are present in all PC application (Hiperterminal, CodeDesigner/Debug, etc...).
This is a part of my code.
DEFINE OSC 20
DEFINE HSER_CLROERR 1
DEFINE HSER_BAUD 57600
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
...
INTCON = %11000000
PIE1.5 = 1
...
ON INTERRUPT GoTo loopdata
...
loopdata:
While RCIF
B1=RCREG
IF B1=48 Then HSerout ["Speed is ...",10,13] ' caracter ascii 48= "0"
IF B1=49 Then ' caracter ascii 49= "1"
For m=1 TO 16
I2CRead sda_A,scl_A,ctl,mem_addr+(m-1),[data[m]]
Next m
HSerout [DEC2 data[1],DEC2 data[2],DEC2 data[3]...,10,13] <-this is the problem!?!
mem_addr=mem_addr+16
EndIF
...
Wend
Resume
Enable
...
dummy:
For X = 0 TO 300
PauseUs 200
Next X
GoTo dummy
...
End
Bookmarks