Hi Rob,
So far I found at least two problems with the pair serial_hw_int_cts and
usart_common.
With pragma target clock 14_745_600 it does not compute correct the
spbrg/brgh pair for 19200bps, but it's correct for 115200.
I guess there are other wrong computed values because this crystal value
gives zero error.
Using a dummy cts bit is sending only a part from the string, instead of
"Hello serial" is sending "Hell_" (the road to hell...) :)
Just curious if someone find in previous projects those errors. Can be
suspected the print_string procedure, particullary counting the number of
the elements inside the string?
procedure print_string(volatile byte out device, byte in str[]) is
var word len = count(str)
var byte i
for len using i loop
device = str[i]
end loop
end procedure
-- Title: Test program for serial_hw_int_cts.jal on PIC16F876, 14.745.600Mhz
include 16f876
pragma target clock 14_745_600 -- xtal frequency
pragma target OSC hs
pragma target LVP disabled
pragma target WDT disabled
include delay
-- set all IO as digital
enable_digital_io()
var volatile bit _485_sense is pin_C5
pin_c5_direction = output
var volatile bit DIG1_R is pin_C1
pin_C1_direction = output
var volatile bit DIG2_R is pin_C2
pin_C2_direction = output
var volatile bit DIG3_R is pin_C3
pin_C3_direction = output
var volatile bit DIG4_R is pin_C4
pin_C4_direction = output
var volatile bit DP_R is pin_B7
pin_B7_direction = output
var volatile bit DIG1_V is pin_A1
pin_A1_direction = output
var volatile bit DIG2_V is pin_A2
pin_A2_direction = output
var volatile bit DIG3_V is pin_A4
pin_A4_direction = output
var volatile bit DIG4_V is pin_A5
pin_A5_direction = output
var volatile bit DP_V is pin_C0
pin_C0_direction = output
portB_direction = output
portB = 0
const serial_hw_baudrate = 115_200
var bit dummyCTS_bit
var bit serial_ctsinv is dummyCTS_bit -- incoming data flow
control
; var bit serial_overflow_discard = true -- With transmit buffer overflow
var bit serial_overflow_discard = false
include serial_hw_int_cts
serial_hw_init()
include print -- output library
const byte str1[] = "Hello serial" -- define a string
_485_sense = high ; TX
print_string(serial_hw_data, str1) -- output string to serial
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---