Hi,
I'm new to PicBasicPro but it works great for the simple stuff I want to do.
I have a lot of PIC12f615's left over from an old LED project and want to re-use them.
My intention it so create a load of LED RGB nodes, that can attach to a main communication bus, and be indivdually controlled from one source.

I have got SERIN2 working successfully, well, I dont really understand all the arguments yet. But I can send serial from another device and turn and LED on and off when I want.

I have also got PWM to work well, I can fade an LED up and down, so now, i need to combine the two!

The main problem I have is that the PWM command goes, PIN; DUTY; CYCLE and the CYCLE seems to be the length that the PWM is on for. What I want is for the PWM to be constantly on and IF data is sucessfully recived through SERIN2 and it is a number, set the PWM to that value, there for I could control the PWM via another device. But ... in my experiements.

Tnis is how I thought it would work but it does not.

----------------

DEFINE OSC 4
output 4

ANSEL = 0 ' disable A/D converter

Command var byte ' variable to receive data into
pwmval var WORD

InputData var byte
PulseWidth var byte

loop:

serin2 2,41356,0, nodata, [inputData]

pulseWidth = inputData

nodata:

pwm 4,pulseWidth,1

goto loop

end

--------------------

the reason for this is, as far as I have read, the routine in nodata: will get executed when there is nothing coming in, and ideally I want that to execture a PWM and go back to listening for serial, so the CYCLE is 1. and also the 3 argument in SERIN2 is the wait ? length ? so really I dont want it to wait at all.
If anyone could help me that would be great, all I want to do is change the PWM of and LED though SERIN21

thanks - j