Hi Joep,

I noticed you committed among others a few (updated?) samples for serial_software. I'm afraid I'm not very satisfied with their quality. Take the sample 16f648a_serial_software.jal:

Lines 59..62:

pin_TX_direction = output

alias serial_sw_tx_pin is pin_TX
alias serial_sw_rx_pin is pin_RX

These statements rely on the existence of 'pin_TX', 'pin_RX' and 'pin_TX_direction' in the device file. But a PIC without USART doesn't have these aliases. This makes it difficult for a (beginning) user to convert this sample to a PIC without USART.

You should not only to change the aliases into a basic pin (e.g. pin_A0, pin_A1), but also add aliases for the pin_directions, e.g.

 alias serial_sw_tx_pin_direction is pin_A0_direction
 alias serial_sw_rx_pin_direction is pin_A1_direction

and *after* that you can set the direction of the TX pin.

 serial_sw_pin_rx_direction = output


Line 80:

serial_sw_read(x)

This gives a warning (and warnings are errors according to Eur!)

warning: return value ignored

No check on the returnvalue of the function serial_sw_read(x)!
I suggest to change lines 80..81 into:

if (serial_sw_read(x)) then
   serial_sw_write(x + 1)
> end if

and also move the lines:

-- output the string, the pseudo var is the first param.
const byte str1[] = " - Test print.jal- bytes\r\n"   -- define a string
print_string(serial_sw_data, str1)                 -- output string

to before the forever loop, because once is enough I think!


Of course I could have changed the sample(s) myself, but since you generated these .....

Regards, Rob.

--
R. Hamerling, Netherlands --- http://www.robh.nl

--
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.

Reply via email to