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

Compilation problems on WS2812 code in Code Library
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bmete



Joined: 13 Jul 2023
Posts: 37

View user's profile Send private message

PostPosted: Mon Jul 24, 2023 7:26 am     Reply with quote

Hello friends, first of all thanks for your interests.

Ttelmah:

Actually, I was going to use the hardware RS232 pins to drive the LED, and the other RS485 pins that I defined as software (B5/B4) would be used to communicate with other boards. But I made a mistake. The code I shared above is completely wrong. The configuration I want to do is actually this:

Code:

#use delay(clock = 32M)

//port1
#use rs232(stream = LED_STREAM, baud = 8000000, xmit = PIN_C6, rcv = PIN_C7, bits = 8, parity = N, stop = 0, ERRORS, INVERT)

//port2
#define RS485_USE_EXT_INT FALSE
#define RS485_RX_PIN PIN_B5
#define RS485_TX_PIN PIN_B4
#define RS485_ID 0
#include <rs485.c>//NOTE: only one RS485 port is supported by the driver


Configuration should be like that. After compiling the code without error, I was able to drive the LEDs, but I haven't done rs485 communication over the B5 and B4 pins yet. Thinking that I don't need a very high connection speed during RS485 communication, I allocated software pins to communication and hardware pins to drive LEDs.

temtronic:

Thank you, I searched the keyword and I found something useful, but I'm racing against time, so I need to run the system somehow in minimum time. If I don't get a result from the other method, I will switch to the bit banging method. Thanks for your support.


Last edited by bmete on Tue Jul 25, 2023 11:42 pm; edited 1 time in total
drolleman



Joined: 03 Feb 2011
Posts: 116

View user's profile Send private message

PostPosted: Tue Jul 25, 2023 3:17 pm     Reply with quote

I wrote mine in assembly to make it work at 64mhz, 40mhz or less won't work, too slow. Also use #defines, it will make your life easier. 64 / 4 is 16m instructions / sec not very fast.

David
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Wed Jul 26, 2023 1:11 am     Reply with quote

Yes.
This is why cheating and using the SPI or UART to do the actual bit timing
is the way to go. Even doing this, you have to be quite careful on fetching
the bytes, to avoid gaps in the data stream.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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