Travis M. Best

12-15-2009, 11:25 AM

I am trying to figure out how to split my program in two parts and be able to transfer my A/D Data between the two maybe by using a cog???

CON

_CLKMODE = XTAL1 + PLL16X

_XINFREQ = 5_000_000

OBJ

ADC : "CD_LTC1298"

PWM : "PWM_32_v2"

PUB MAIN | Temp,Temp1,Temp2,smpcnt,dimled,briled,midled,offle d,offdim,dim,dimdled,leda,ledb,ledc,ledd,lede,ledf ,ledg,ledh,ledchange,dimdim

adc.start(0)

PWM.Start

dim := 0

repeat

repeat until smpcnt > 59

Temp1 := adc.GetADC(0)

Temp2 := Temp2 + Temp1

smpcnt := smpcnt + 1

Temp := Temp2 / 60

offled := 0

offdim := 1

dimled := 30

midled := 40

briled := 100

smpcnt := 0

temp1 := 0

temp2 := 0

If Temp =< 81

If ledh < 100

ledchange := 100

dimdim := 30

ledh := 0

ledb := 0

ledc := 0

ledd := 0

lede := 0

ledf := 0

ledg := 0

PWM.Duty(4,briled,5000)

PWM.Duty(7,offled,5000)

PWM.Duty(9,dimled,5000)

PWM.Duty(13,dimled,5000)

PWM.Duty(14,dimled,5000)

PWM.Duty(22,dimled,5000)

PWM.Duty(23,offdim,5000)

PWM.Duty(25,offdim,5000)

PWM.Duty(26,offdim,5000)

ledh :=ledh + 1

If Temp => 82

If Temp =< 107

If leda < 100

ledchange := 100

dimdim := 30

ledb := 0

ledc := 0

ledd := 0

lede := 0

ledf := 0

ledg := 0

ledh := 0

PWM.Duty(4,offled,5000)

PWM.Duty(7,briled,5000)

PWM.Duty(9,briled,5000)

PWM.Duty(13,dimled,5000)

PWM.Duty(14,dimled,5000)

PWM.Duty(22,dimled,5000)

PWM.Duty(23,dimled,5000)

PWM.Duty(25,dimled,5000)

PWM.Duty(26,dimled,5000)

leda :=leda + 1

CON

_CLKMODE = XTAL1 + PLL16X

_XINFREQ = 5_000_000

OBJ

ADC : "CD_LTC1298"

PWM : "PWM_32_v2"

PUB MAIN | Temp,Temp1,Temp2,smpcnt,dimled,briled,midled,offle d,offdim,dim,dimdled,leda,ledb,ledc,ledd,lede,ledf ,ledg,ledh,ledchange,dimdim

adc.start(0)

PWM.Start

dim := 0

repeat

repeat until smpcnt > 59

Temp1 := adc.GetADC(0)

Temp2 := Temp2 + Temp1

smpcnt := smpcnt + 1

Temp := Temp2 / 60

offled := 0

offdim := 1

dimled := 30

midled := 40

briled := 100

smpcnt := 0

temp1 := 0

temp2 := 0

If Temp =< 81

If ledh < 100

ledchange := 100

dimdim := 30

ledh := 0

ledb := 0

ledc := 0

ledd := 0

lede := 0

ledf := 0

ledg := 0

PWM.Duty(4,briled,5000)

PWM.Duty(7,offled,5000)

PWM.Duty(9,dimled,5000)

PWM.Duty(13,dimled,5000)

PWM.Duty(14,dimled,5000)

PWM.Duty(22,dimled,5000)

PWM.Duty(23,offdim,5000)

PWM.Duty(25,offdim,5000)

PWM.Duty(26,offdim,5000)

ledh :=ledh + 1

If Temp => 82

If Temp =< 107

If leda < 100

ledchange := 100

dimdim := 30

ledb := 0

ledc := 0

ledd := 0

lede := 0

ledf := 0

ledg := 0

ledh := 0

PWM.Duty(4,offled,5000)

PWM.Duty(7,briled,5000)

PWM.Duty(9,briled,5000)

PWM.Duty(13,dimled,5000)

PWM.Duty(14,dimled,5000)

PWM.Duty(22,dimled,5000)

PWM.Duty(23,dimled,5000)

PWM.Duty(25,dimled,5000)

PWM.Duty(26,dimled,5000)

leda :=leda + 1