tsl230 and mlx90614 with spin newbie needs help with program
I am trying to run both the tsl230 and Mlx90614 on the propellor. I can get each to individually run,
but when I try to comine the two with the attached spin program, nothing happens. Any thoughts?
but when I try to comine the two with the attached spin program, nothing happens. Any thoughts?
Comments
-Phil
Not to sound really stupid, but I am really stupid with regard to this. Can you give me a code example? I'm not sure how to declare the stacks in an array.
Thanks
fsb
CON _clkmode = xtal1 + pll16x _XinFREQ = 5_000_000 'hardware constants inpin = 2 ctrlpinbase = 0 'software constants samplefreq = 40 autoscale = true cr =13 var long _scale 'variable for tsl230 long _raw 'variable for tsl230 long _sample 'variable for tsl230 [color=red]long stack_tsl[128][/color] [color=red]long stack_display[128][/color] [color=red]long stack_mlx[128][/color] long temp 'variable for mlx ir temp OBJ debug: "fullduplexserial" 'debug: "SerialMirror" 'Same as fullDuplexSerial, but can also call in subroutines lfs : "tsl230_pi" mlx : "MLX90614" PUB Go cognew (get_tsl230,[color=red]@stack_tsl[/color]) cognew (get_mlx,[color=red]@stack_mlx[/color]) cognew (display_data,[color=red]@stack_display[/color]) pri display_data 'pause_ms(1000) Debug.start(31, 30, 0, 57600) 'Start FullDuplexSerial repeat Debug.Str(String("DATA, TIME,")) Debug.dec(_scale) Debug.Str(String(", ")) Debug.dec(_raw) Debug.Str(String(", ")) Debug.dec(_sample) debug.tx(cr) debug.str(string("MLX90614 Temp: ")) 'display title string 'get the temperature in Kelvin debug.dec(temp >> 8) 'display integer potion 'display hundredths of a Kelvin debug.str(string(" K ")) Debug.Str(String(13)) debug.tx(cr) pause_ms (1000) 'waitcnt(clkfreq / 10 + cnt) pri get_tsl230 lfs.Start(inpin,ctrlpinbase,samplefreq,autoscale) 'start l2f driver object lfs.setSampleFreq(240) 'set update rate to 240 samples/sec repeat _scale := lfs.getScale _raw := lfs.getRawSample _sample := lfs.getSample pause_ms (1000) pri get_mlx mlx.start(6,7,9600) repeat temp := mlx.GetTempK(1) pause_ms (500) ' PRI Pause_ms(msDelay) waitcnt(cnt + ((clkfreq / 1000) * msDelay)) DAT {{ ┌────────────────────────────────────────────────────────────────────────────────────────────┐ │ TERMS OF USE: MIT License │ ├────────────────────────────────────────────────────────────────────────────────────────────┤ │Permission is hereby granted, free of charge, to any person obtaining a copy of this │ │software and associated documentation files (the "Software"), to deal in the Software │ │without restriction, including without limitation the rights to use, copy, modify, merge, │ │publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons │ │to whom the Software is furnished to do so, subject to the following conditions: │ │ │ │The above copyright notice and this permission notice shall be included in all copies or │ │substantial portions of the Software. │ │ │ │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, │ │INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR │ │PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE │ │FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR │ │OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER │ │ │DEALINGS IN THE SOFTWARE. │ └────────────────────────────────────────────────────────────────────────────────────────────┘ }}
-Phil
Thanks!
It works (so basically, If I understand what I did wrong, in my original code, I essentially declared 1, not 128 for the stack, hence, they were too small)
fsb
P.S.
Any ideas on how to convert Kelvin to degrees celsius (both positive and negative?)
-Phil