Is there a different requirement for Printbin when using CTS/RTS?
[quote:658ac21b19]
Output:
01 02 03 04 05 06 07 08
01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 09 0A 00 00 00 00 00 00 00 00 00 00 0A
|..................................payload(20)......................................................................|...I
[/quote:658ac21b19]
[code:1:658ac21b19]$regfile = "m644pdef.dat"
$crystal = 8000000
$hwstack = 128
$swstack = 128
$framesize = 128
'=========================================
'Hardware UART Interface
'=========================================
'Serial buffered input and output are extended with CTS-RTS handshake.
'RTS will be 0 initial. When the input buffer is full, RTS will be made 1.
'When the input buffer is read with the serial commands and thus get room again, RTS will be made 0 again
'The same is used for CTS. CTS is an input pin which will be checked before sending data from the output buffer.
'If CTS is made 1 by the sender, it's buffer is full and no data are sent. When CTS is 0, data are sent.
Open "com2:" For Binary As #1
Config Com2 = 38400 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
'Config Serialout1 = Buffered , Size = 24
Config Serialin1 = Buffered , Size = 48 , Bytematch = All , Cts = PINB.1 , Rts = PINB.2 , Threshold_full = 40 , Threshold_empty = 2
'CTS is the CTS pin to use which is an input pin. RTS is the RTS pin to use which is an output pin.
'It is important that pins are used that are bit addressable. (address below &H3F)
Dim Payload(20) As Byte , I As Byte
Clear Serialin1
'Clear Serialout1
For I = 1 To 10 : Payload(i) = I : Next
I = 10
Printbin #1 , Payload(1) ; 8 'OK
Printbin #1 , Payload(1) ; I 'all 20 bytes are sent plus value of I
End 'end program
Serial1bytereceived:
Pushall
I = 10
Popall
Return[/code:1:658ac21b19]
Secondly, when the OUTPUT buffer is included, Printbin does not print at all ... regardless of the settings on PINB.1 and PINB.2.
Ennio
[b:658ac21b19][color=red:658ac21b19](BASCOM-AVR version : 2.0.7.7 , Latest : 2.0.7.6 )[/b:658ac21b19][/color:658ac21b19]
↧