Hard of thinking - Data sent to parallax serial terminal
Hugh
Posts: 362
Hi,
I have the following code generating data from an MCP3208:
When started, the data shown on the Serial Terminal is about what I expected, but as a concatenated continuous stream of numbers.
I added Line1 to try and add a delimiter: all the data went to 0.
I added Line2 to try and add a line feed: all the data went to 0 (albeit in a line scrolling across the display window).
The (default) preferences in serial terminal appear to be correct, i.e, ASCII 10 = line-feed. I have also tried sending PUTC(13).
If anyone has ideas as to where I might be going wrong I would be very grateful for suggestions or comments.
Hugh
I have the following code generating data from an MCP3208:
CON _clkmode = xtal1 + pll16x 'Set up frequency and clock data _xinfreq = 5_000_000 pinCLK = 0 pinDIO = 1 pinCS = 2 VAR byte Stack2[500] OBJ ADC : "MCP3208" DEBUG : "SimpleDebug" PUB Main | i,r DEBUG.Start(9600) waitcnt(15000000+ cnt) r := cognew(ADC.start(pinDIO, pinCLK, pinCS, %11111111), @Stack2) debug.dec(r) repeat waitcnt(1500000+ cnt) DEBUG.dec(ADC.in(0)) 'debug.str(string("-")) '<----- Line1 'debug.putc(10) '<------Line2
When started, the data shown on the Serial Terminal is about what I expected, but as a concatenated continuous stream of numbers.
I added Line1 to try and add a delimiter: all the data went to 0.
I added Line2 to try and add a line feed: all the data went to 0 (albeit in a line scrolling across the display window).
The (default) preferences in serial terminal appear to be correct, i.e, ASCII 10 = line-feed. I have also tried sending PUTC(13).
If anyone has ideas as to where I might be going wrong I would be very grateful for suggestions or comments.
Hugh
Comments
So, your cognew won't do what you expect. And usually you don't have to call cognew for objects at all, because that is what a start function would do for you if the object really needs a COG!
If you have a look at the source of MCP3208 you'll see, that it really is doing a cognew inside of the start function.
Sometimes the more you stare at something, the less obvious problems become.
D'Oh!