Shop OBEX P1 Docs P2 Docs Learn Events
Debugging Serial Terminal — Parallax Forums

Debugging Serial Terminal

QuadrtrFlyrQuadrtrFlyr Posts: 73
edited 2011-03-01 20:23 in Propeller 1
Hello folks,

I am currently attempting to print out values coming from my MCP3208 ADC converter in the parallax serial terminal window and I am having trouble accomplishing this. I am pretty sure my code is correct, but recently fried my PropUSB built in EEPROM and might have fried something that deals with this usb interface.

Here is my code:
CON
  _CLKMODE = XTAL1 + PLL16X
  _XINFREQ = 5_000_000

OBJ
  adc   :       "mcp3208"
  Debug :       "FullDuplexSerialPlus"
  Terminal :    "Parallax Serial Terminal"

VAR
  LONG curradc

PUB main

Debug.start(31,30,0,38400)
waitcnt(clkfreq*2 +cnt)  
Debug.tx(Debug#CLS)
adc.start(29, 28, 27, %1111_1111)                       ' start ADC MCP3208            

repeat
  Debug.tx(1)                                           ' Send the HOME code to the DEBUG terminal
  Debug.str(string("Gyroscope ADC Value"))              ' Display Header Text
  Debug.tx(13)                                          ' Send the RETURN key code to the DEBUG terminal 
  curradc := adc.in(0)                                  ' Get input
  Debug.dec(curradc)                                    ' Print
  Debug.str(string("   "))

Regards

Robert

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-03-01 19:33
    So what exactly isn't working the way you expect it to?

    It seems you can download stuff to the prop (big assumption here) which would suggest that the USB part is still working. I'm a bit concerned about using the I2C pins (28 & 29, by convention) for the ADC. Is that correct?
  • QuadrtrFlyrQuadrtrFlyr Posts: 73
    edited 2011-03-01 19:49
    Yes, I am using pins 27, 28, and 29 for the ADC. (made sure) The code downloads only onto the RAM and will NOT download onto EEPROM. When I open the parallax serial terminal the first 10 or so terms coming from the ADC are shown and then the terminal stops updating and receiving values. It looks as if it was disabled but it is still enabled... I'm betting something is messed up with my prop chip but was hoping something was wrong with the code?
    Some extra info: I burnt parts of my PropUSB version chip by putting a 13V supply into the VIN pin.... it still works but I don't know the extent of the damage...

    Robert
  • kuronekokuroneko Posts: 3,623
    edited 2011-03-01 19:59
    Code looks fine and runs OK (with fake ADC values). What happened to the EEPROM normally attached to pins 29/28? I know one can use some trickery but I'd have thought that mixing SPI with I2C on the same pins doesn't go down too well. Anyway, what makes you think the terminal stops updating? For example, if the actual ADC value stays constant you wouldn't see a change in the terminal.

    Could you add an incrementing value (result++) to your output to verify that it actually stopped?
  • QuadrtrFlyrQuadrtrFlyr Posts: 73
    edited 2011-03-01 20:23
    The EEPROM attached to pins 28/29 is still there...... problem solved. I switched over to pins 24-26 and it works like a charm! Thanks kuroneko.

    Regards,
    Robert
Sign In or Register to comment.