Bascom Hilfe:
CONFIG PRINT
Top Previous Next
Action
Configure the UART to be used for RS-485
Syntax
CONFIG PRINT0 = pin
CONFIG PRINT1 = pin
Remarks
pin
The name of the PORT pin that is used to control the direction of an RS-485 driver.
mode
SET or RESET
Use PRINT or PRINT0 for the first serial port. Use PRINT1 for the second serial port.
When you use RS-485 half duplex communication you need a pin for the direction of the data. The CONFIG PRINT automates the manual setting/resetting. It will either SET or RESET the logic level of the specified pin before data is printed with the Bascom print routines. After the data is sent, it will inverse the pin so it goes into receive mode.
You need to set the direction of the used pin to output mode yourself.
See also
CONFIG PRINTBIN
Code:
Example
'------------------------------------------------------------------------------
'name : rs485.bas
'copyright : (c) 1995-2006, MCS Electronics
'purpose : demonstrates
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'------------------------------------------------------------------------------
$regfile = "m48def.dat" ' we use the M48
$crystal = 8000000
$baud = 19200
$hwstack = 32
$swstack = 32
$framesize = 32
Config Print0 = Portb.0 , Mode = Set
Config Pinb.0 = Output 'set the direction yourself
Dim Resp As String * 10
Do
Print "test message"
Input Resp ' get response
Loop
in den Plänen hab ich auch mal rumgepinselt ... siehe Anhang
Lesezeichen