passing a varible to a cog
Sawmiller
Posts: 276
hi guys, i seem to not be able to figure out how to pass a varible to a cog...
what i want is for the adc to constantly update a memory location, and the rest of the program to access it when needed. i made a separate object max_1270 , but i cant seem to interface it, ( does bad things to the tv display )
heres the programs , if you can fix it so i can have max_1270 running in a cog continously and the rest able to access it i'd appricate it...
but please comment it so i can figure it out.. that way i'll get the concept.( have been at the manual several times now)
dan
sawmillmain works, sawmillmain rev1 and max_1270 are where i tried to separate them
thanks for lookin
dan
what i want is for the adc to constantly update a memory location, and the rest of the program to access it when needed. i made a separate object max_1270 , but i cant seem to interface it, ( does bad things to the tv display )
heres the programs , if you can fix it so i can have max_1270 running in a cog continously and the rest able to access it i'd appricate it...
but please comment it so i can figure it out.. that way i'll get the concept.( have been at the manual several times now)
dan
sawmillmain works, sawmillmain rev1 and max_1270 are where i tried to separate them
thanks for lookin
dan
Comments
The basic idea is sound ... Start a cog that continuously updates a variable referenced by the main cog. The way you did it is fine otherwise. I didn't look at the rest of the logic.
dan
ahh well, all in one program is ok, for me, was just hoping to be able to contribute max_1270 as a object for others.
thanks for the help
dan
still doesnt work thou, its like it never comes back from cognew
i just have to refer to adc.start in my main program
var·· long stack1[noparse][[/noparse]20]
·
pub start(control,average,ADC_addr)
· cognew(get_count(control,average,ADC_addr),@stack1)
·
·············
pub get_count(control_bit, average_sample, ADC_count_address) | temp, adresult_temp
dont know why it wouldnt work from main, but at least it works now.
dan