Generate non-uniform pulse
I am looking to generate two non-uniform pulse on two output lines to cycle two individual components. The cycle time is on the order of 5 milliseconds. I have the sequence in a spreadsheet with the on/offs for each component at each 5ms time step. Is there an easy way to have the propeller take the sequence from a spreadsheet or do i have to create a line for every timestep?

Comments
Doing it in real time with ever changing data might be a bit more difficult.
H
How big is the spreadsheet ?
If you only need this once, a copy/paste/edit can work, if you want to create many 'build variants' then I've used programs like FreeBasic to do simple file table conversions.
If you want this more 'live', FreeBasic can also do File to Serial Data quite easily.
[www.freebasic.net &
fbide.freebasic.net & this Debug is quite good
http://www.freebasic.net/forum/viewtopic.php?f=8&t=13935
]
and if you store the differences instead the 5ms on/off values and use waitxx
the file can be smaller and the processing faster
CON _clkmode = xtal1 + pll16x ' Feedback and PLL multiplier _xinfreq = 5_000_000 ' External oscillator = 5 MHz TimeSt = 20 PUB LedOnOff dira[0] := 1 dira[1] := 1 repeat if ina[3] == 1 ' If pushbutton pressed outa[1] := 0 outa[0] := 0 waitcnt(clkfreq/TimeSt + cnt) outa[1] := 0 outa[0] := 0 waitcnt(clkfreq/TimeSt + cnt) outa[1] := 0 outa[0] := 0pri pules_gen | idx1, idx2, t, pw ' launch with cognew idx1 := 0 ' reset pulse indexes idx2 := 0 frqa := 1 ' inc phsa +1 each tick ctra := (%00100 << 26) | PULSE_1 ' setup for NCO mode; output on PULSE_1 dira[PULSE_1] := 1 ' makepin an output frqb := 1 ctrb := (%00100 << 26) | PULSE_2 dira[PULSE_2] := 1 t := cnt ' sync 5ms timer repeat repeat while (ina[ENABLE] == 0) ' hold while disabled phsa := 0 ' prevent false pulse phsb := 0 t := cnt ' resync loop timer pw := long[@Pulses1][idx1++] ' read pulse width if (pw =< 0) ' if end of table pw := long[@Pulses1][0] ' read 1st element idx1 := 1 ' reset table index phsa := pw * -US_001 ' start pulse 1 pw := long[@Pulses2][idx2++] if (pw =< 0) pw := long[@Pulses2][0] idx2 := 1 phsb := pw * -US_001 waitcnt(t += constant(5 * MS_001)) ' loop period is 5ms dat { pulse values } '' Specified in microseconds '' -- tables can be different lengths '' -- use -1 to specify end of table Pulses1 long 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 long -1 Pulses2 long 1000, 1500, 2000, 2500 long -1once i understand your code better I think i am going to try and implement it.
First off, I will try to explain a little better what i am trying to do. The table below shows a part of the pulse cycle I would like to do.
Then, I have a question regarding the code you uploaded.
The following line in your I think puts the Pulse_1 in high for "pw * -US_001"
phsa := pw * -US_001
I am not sure whether the US_100 is defined anywhere.
As before, this runs in its own cog -- for grins as I don't know what you're doing with these pulses. When enabled, the code will run through the entire table. If you want the outputs to stop as soon as enable is released, I can show you how to code that (it's easy).
pri pulse_gen | t, p_table, ledbits, ms dira[LED1..LED2] := %11 ' make outputs repeat outa[LED1..LED2] := %00 ' LEDs off t := cnt ' set delay sync point repeat while (ina[ENABLE] == 1) ' if enabled p_table := @PulseMap ' reset table pointer repeat ledbits := byte[p_table++] ' read bits from table ms := byte[p_table++] ' read timing from table if (ledbits =< %11) ' if valid bits outa[LED1..LED2] := ledbits ' update outputs waitcnt(t += (ms * MS_001)) ' hold else quit ' cycle is complete dat { pulse table } PulseMap byte %00, 5 ' 0.000 byte %01, 10 ' 0.005 byte %11, 10 ' 0.015 byte %10, 20 ' 0.025 byte %00, 15 ' 0.045 byte %01, 10 ' 0.060 byte %10, 10 ' 0.070 byte %11, 5 ' 0.080 byte %10, 10 ' 0.085 byte %00, 5 ' 0.095 byte -1, -1 ' end of table