Posted: Mon Jun 08, 2020 9:07 am Post subject: Software UART parity error detection
Hi,
I wonder if it is possible to detect parity errors when using the software uart?
I changed the software uart example from BASCOM help to 7 bits and even parity (and port pins and crystal frequency).
Using the terminal programm Tera Term even and odd parity are both accepted and return the same result.
Best regards
Chris
Code:
$regfile="m168def.dat" $crystal=7372800
$hwstack=128 $swstack=128 $framesize=128
Dim B AsByte
Waitms100
'Open a TRANSMIT channel for output
Open"comd.1:19200,7,e,1"ForOutputAs #1
Print #1 , "serial output"
'Now open a RECEIVE channel for input
Open"comd.0:19200,7,e,1"ForInputAs #2
'Since there is no relation between the input and output pin
'there is NO ECHO while keys are typed
Print #1 , "Press any alpha numerical key"
'With INKEY() we can check if there is data available
'To use it with the software UART you must provide the channel
Do
'Store in byte
B =Inkey(#2)
'When the value > 0 we got something
If B >0Then
Print #1 , Chr(b)'Print the character
End If
Loop
Close #2'Close the channels
Close #1
End
(BASCOM-AVR version : 2.0.7.8 , Latest : 2.0.8.2 )
The reason I am asking is that I want to implement the SDI-12 protocol which is used for some sensors. SDI-12 uses 7 bit and even parity.
CRC can optionally be included, see SDI-12 specification: http://www.sdi-12.org/current_specification/SDI-12_version-1_4-Jan-10-2019.pdf
and I have implemented that already.
I was just curious to know if I can detect parity errors as well.
So far I have never used parity, normally I take 8,N,1 settings for UART and use CRC.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum