newlevel1 = RCREG 'This is your target channel data
portA.2 = newlevel1 'i want dimming a LED on PORTA.2
RCSTA.7 = 0 'turn off the USART
--------
Just curious - how do you expect a single pin, which at any given time can only have one of two discretes states, to represent all 255 possible values of DMX channel data?
Hint: Pulse Width Modulation is your friend. It's a way to time-average a bunch of discrete states (ones and zeros) to approximate various channel levels.
Search for 'PWM' and see what you find. Check out 'HPWM' in your PBP manual. You'll also find many, many examples of software controlled PWM buried in this forum.
And if you're really ambitious, google for Artistic License's 'Bit Angle Modulation' white paper. It's ingeniously simple and requires almost no work to code the routine in software.
JEC
EDIT: Didn't realize this same question had been replied to in two other threads in the past few hours. Sorry to repeat what everyone else has been saying re: PWM & R'ing the Friendly Manual.
Bookmarks