Migration from MEGA to TEENSY3.2

Status
Not open for further replies.

BOBILLIER

Active member
Hi All
I have in project to migrate one project developed for Arduino MEGA to TEENSY 3.2. Then i have try to directly compile the sketch and encounter just one error (strange). In my initial project, i declare in setup the next command: Serial2.begin(9600, SERIAL_7N1); but SERIAL_7N1 seem not be support then i have replace it by SERIAL_7E1. Do you think that can create problem ? Do you plan to update Serial library with this option ?
One another question is about Analog conversion, in MEGA there is 10bits ADC and the value return is from 0 to 1023, but TEENSY is 16bits ADC. What value is returned ? 0 to 65535 ?
Thanks for your help.
Eric
 
The Teensy's ADCs are theoretically 16bit ADCs, thus they return values from 0 to 65535. But due to noise and other issues, only the upper 12bits in single ended mode or the upper 13bits in differential mode are significant. Thus, eliminating the insignificant bits will give you in single ended mode significant results from 0 to 4095, for example with this transformation: readVal12=(readval16>>4); and in differential mode significant results from 0 to 8191 with readval13=(readval16>>3).
 
but SERIAL_7N1 seem not be support then i have replace it by SERIAL_7E1. Do you think that can create problem ?

Yes, that will almost certainly be a problem. 7E1 is not similar to 7N1.

Do you plan to update Serial library with this option ?

No, the hardware simply does not support 7 bit format.

If you only need to send, you could use regular 8N1 format, and before transmitting data set the MSB to 1 (logical or every byte by 0x80). For receiving, there is no perfect solution.


One another question is about Analog conversion, in MEGA there is 10bits ADC and the value return is from 0 to 1023, but TEENSY is 16bits ADC. What value is returned ? 0 to 65535 ?

By default, the ADC is configured to 10 bits, for compatibility with normal Arduino code.

You can use analogReadResolution() to reconfigure.
 
Status
Not open for further replies.
Back
Top