Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - ConradDennis

Pages: [1]
Projects / Re: 8-channel led controller
« on: July 29, 2013, 02:17:26 AM »
In case anybody is interested:

the attached code turns an SBC68EC into an 8-channel led controller (using PCM). It will be used to control the color of the led light in my bathroom   :mrgreen:.  The level of the channels are controlled via UDP commands from my little linux-based server (which is also used to play music in the bathroom). The next step is to get the colors to change depending on the music and to make an LCD and/or IR interface to control everything. (If you happen to know where I can find a waterproof IR remote control with a decent number of buttons please let know  :wink: )

I have no doubt:

   - the code is badly written and could be improved in lots of ways;
   - there are lots of better/cheaper(?) ways to achieve this;
   - my code contains lots of bugs

If you don't like it, don't use it   :evil:  It's the first thing I wrote for my SBC68EC so don't expect too much anyway.  As the webserver code is made available for free I think it's only fair I will give back whatever I made with it.

Note: I used MPLAB IDE 7.50 and MPLAB C18 v3.10 Student Edition.

If you find this project any useful I'll be happy to hear from you



Below is an excerpt of the README:


This firmware is intended for the SBC68EC board made by Modtronix (
It is based on the webserver 3.0.6 source code that is freely downloadable from the Modtronix
website. This program creates 8 PCM channels with 64 levels. You can use UDP commands to
control the channels.  It's intended to be used to drive RGB leds.

PCM is totaly done in software as the PIC on the SBC68EC only has 2 channels (the SBC65EC has 5)
but I wanted at least 6 channels to control the RGB leds in my bathroom. Port B is used to
connect to the leds although port F may have been a better choice as pin B6 also connects
to the SBC's status led. This can be changed in ledcontroller.h.

Note: to keep the leds from flickering the webserver is turned off as this would steal too
many cpu cycles.  PCM is done using timer 3. There are 64 different levels available for the
leds, this is defined in minitick.h. Increasing the number of levels means more interrupts
per second which means the board may stall or you may start seeing flickering during
network communication.  You can change the number of available channels in ledcontroller.h
if you don't need 8, this may improve performance and may allow you to raise the number
of levels.


  - UDP server: allowing you to control the RGB levels via the network. Every command is
  - timer
  - serial debugging using mxdebug.xml

UDP commands

Channel modes

  0-7   copy channel 0-7
  F     randomize channel (not yet implemented, need to figure out how to get a random
        number on a pic)

UDP commands:  multiple commands can be separated by '&', answers will also be separated by '&'

  '?cx'   return value of channel X
                returns: xx   hex representation of value
  '?mx'   return mode of channel X
                returns: x    hex representation of mode
  '?x'    return max channel number
  '?e'    enabled?

  'cx=yy' set channel x value to 0xYY (HEX), max value = MINITICKS_PER_CYCLE=64 (0x40)
  'mx=0y'  set channel x mode to 0x0Y (HEX)

  '0'   turn all channels off
  '1'    turn all channels on (smooth transition to original values)


hello friend I know thread is very old but can you provide the exact codes of controller.. I am trying hard to search these codes so can you help me?Please reply thanks in advance:)

Pages: [1]