View previous topic :: View next topic |
Author |
Message |
newguy
Joined: 24 Jun 2004 Posts: 1907
|
#use rs232, DALI and manchester? |
Posted: Mon Sep 14, 2020 1:19 pm |
|
|
I've consulted the help with v5.093 and I can't see any mention of whether the compiler's #use rs232() supports DALI/manchester? If not, no big deal, I can easily set it up myself.
For example, from the PIC18LF26K83's data sheet:
Quote: | 31.7 General Purpose Manchester
General purpose Manchester is a subset of the DALI
mode. When the UxP1L register is cleared, there is no
minimum wait time between frames. This allows full
and half-duplex operation because writes to the UxTXB
are not held waiting for a receive operation to complete.
General purpose Manchester operation maintains all
other aspects of DALI mode such as:
• Single-pulse Start bit
• Most Significant bit first
• No stop periods between back-to-back bytes
General purpose Manchester mode is configured with
the following settings:
• MODE<3:0> = 1000
• TXEN = 1
• RXEN = 1
• UxP1 = 0h
• UxBRGH:L = desired baud rate
• TXPOL and RXPOL = desired Idle state
• STP = desired number of stop periods
• RxyPPS = TX pin selection code
• TX pin TRIS control = 0
• RXPPS = RX pin selection code
• RX pin TRIS control = 1
• Input pin ANSEL bit = 0
• ON = 1
The Manchester bit stream timing is shown in
Figure 31-7. |
It's just that it would be nice if the compiler supported this already. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Mon Sep 14, 2020 2:38 pm |
|
|
I'd email CCS support, ask them, maybe they'll add to compiler and send you the upgraded version !! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19512
|
|
Posted: Mon Sep 14, 2020 11:46 pm |
|
|
Equally though it is very easy to just enable this yourself.
The UART operation is completely standard, the only thing that has to change is the mode setting.
So:
Code: |
#bit UARTON=getenv("BIT:U1ON")
#byte UART1CON0=getenv("SFR:U1CON0")
#byte U1P1L=getenv("SFR:U1P1L")
#define LIN_MASTER 0xC
#define LIN_SLAVE 0xB
#define DMX 0xA
#define DALI_GEAR 9
#define DALI_DEVICE 8
void select_manchester(void)
{
//Manchester mode is DALI mode, with U1P1L set==0
UARTON=FALSE;
UART1CON0=(UART1CON0 & 0xF0) | DALI_DEVICE; //switch to DALI
U1P1L=FALSE;
UARTON=TRUE; //re-enable UART
}
void main()
{
select_manchester(); //switch UART to manchester mode
//then your code....
|
|
|
|
|