CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#use rs232, DALI and manchester?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

#use rs232, DALI and manchester?
PostPosted: Mon Sep 14, 2020 1:19 pm     Reply with quote

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: 9245
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 14, 2020 2:38 pm     Reply with quote

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: 19546

View user's profile Send private message

PostPosted: Mon Sep 14, 2020 11:46 pm     Reply with quote

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....
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group