-- chip setup
include 18f14k50
-- target frequency to 48 MHz
I am experiencing strange behavior with the print_string() function using
usb_serial and an 18f14k50 and jalv2.4q and jallib version 1.0.0. With the
following code:
pragma target clock 48_000_000
-- no fuses (use bootloader)
pragma BOOTLOADER loader18 2048
pragma fuses no
const byte str_welcome[] = "Hi there"
var byte i -- temporary variable
forever loop
-- poll the usb ISR function on a regular base, in order to
-- serve the USB requests
usb_serial_flush()
-- check if USB device has been configured by the HOST
if ( usb_cdc_line_status() != 0x00 ) then
if !has_shown_welcome_msg then
has_shown_welcome_msg = true
print_string( usb_serial_data, str_welcome )
print_crlf( usb_serial_data )
end if
else
has_shown_welcome_msg = false
end if
-- check for input character
if usb_serial_read( ch ) then
-- echo input character
usb_serial_data = ">"
usb_serial_data = ch
print_crlf( usb_serial_data )
i print_string( usb_serial_data, str_welcome )
print_crlf( usb_serial_data )
blink_led(green)
end if
end if
Under Linux, it prints 3 unprintable characters when a serial connection is
established and each time a key is pressed. Under Windows 8, it prints the
correct string.
If I replace the print_string() function calls by explicitly looping
through the array, i.e.:
;print_string( usb_serial_data, str_welcome )
for 8 using i loop
usb_serial_data = str_welcome[i]
end loop
The string prints normally on both Linux and Windows 8.
Furthermore, if I close the serial terminal and try to re-establish a
connection under either Linux or Windows, I can't reconnect regardless of
which code I use. Under Linux, I receive the error message:
tty_port_close_start: tty->count = 1 port count = 0.
It won't reconnect without manually resetting the 18f14k50.
I suspect the two problems are related, but am not sure....:(
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib.
For more options, visit https://groups.google.com/d/optout.