RS232

Ceviz Viki, özgür ansiklopedi

Git ve: kullan, ara
#use rs232(ayarlar)


Açıklama


İşlemcinin seri iletişim için uart ayarlarını yapar..

Parametreler

STREAM=id

Associates a stream identifier with this RS232 port.  The identifier may then be used in functions like fputc.


BAUD=x

Set baud rate to x


XMIT=pin

Set transmit pin


RCV=pin

Set receive pin


FORCE_SW

Will generate software serial I/O routines even when the UART pins are specified.


BRGH1OK

Allow bad baud rates on chips that have baud rate problems.


ENABLE=pin

The specified pin will be high during transmit.  This may be used to enable 485 transmit. 


DEBUGGER

Indicates this stream is used to send/receive data though a CCS ICD unit.  The default pin used in B3, use XMIT= and RCV= to change the pin used.  Both should be the same pin.


RESTART_WDT

Will cause GETC() to  clear the WDT as it waits for a character.


INVERT

Invert the polarity of the serial pins (normally not needed when level converter, such as the MAX232). May not be used with the internal UART.


PARITY=X

Where x is  N, E,  or O.


BITS =X

Where x is 5-9  (5-7 may not be used with the SCI).


FLOAT_HIGH

The line is not driven high.  This is used for open collector outputs.  Bit 6 in RS232_ERRORS is set if the pin is not high at the end of the bit time.


ERRORS

Used to cause the compiler to keep receive errors in the variable RS232_ERRORS and to reset errors when they occur.


SAMPLE_EARLY

A getc() normally samples data in the middle of a bit time.  This option causes the sample to be at the start of a bit time.  May not be used with the UART.


RETURN=pin

For FLOAT_HIGH and MULTI_MASTER this is the pin used to read the signal back. The default for FLOAT_HIGH is the XMIT pin and for MULTI_MASTER the RCV pin.


MULTI_MASTER

Uses the RETURN pin to determine if another master on the bus is transmitting at the same time.  If a collision is detected bit 6 is set in RS232_ERRORS and all future PUTC's are ignored until bit 6 is cleared.  The signal is checked at the start and end of a bit time.  May not be used with the UART.


LONG_DATA

Makes getc() return an int16 and putc accept an int16.  This is for 9 bit data formats.


DISABLE_INTS


Will cause interrupts to be disabled when the routines get or put a character. This prevents character distortion for software implemented I/O and prevents interaction between I/O in interrupt handlers and the main program when using the UART.


STOP=X


To set the number of stop bits (default is 1).  This works for both UART and 

non-UART ports.


TIMEOUT=X

To set the time getc() waits for a byte in milliseconds.  If no character comes in within this time the RS232_ERRORS is set to 0 as well as the return value form getc().  This works for both UART and non-UART ports.


SYNC_SLAVE

Makes the RS232 line a synchronous slave, making the receive pin a clock in, and the data pin the data in/out.


SYNC_MASTER

Makes the RS232 line a synchronous master, making the receive pin a clock out, and the data pin the data in/out.


SYNC_MATER_CONT

Makes the RS232 line a synchronous master mode in continuous receive mode.  The receive pin is set as a clock out, and the data pin is set as the data in/out.


UART1

Sets the XMIT= and RCV= to the chips first hardware UART.


UART2

Sets the XMIT= and RCV= to the chips second hardware UART



Örnek

#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)