Shop OBEX P1 Docs P2 Docs Learn Events
Simple Debug object — Parallax Forums

Simple Debug object

UnsoundcodeUnsoundcode Posts: 1,532
edited 2007-10-25 08:11 in Propeller 1
I am finding the Prop easy to get into and see it has potential for complexity beyond my scope. Because I find it easy I enjoy and because I enjoy I learn faster.
I am at a small hurdle at the moment using the SimpleDebug object in conjunction with the FullDuplex object on a USB Propstick. This is my code that interfaces with the serial objects

obj port:"SimpleDebug"
PUB main
port.start(4800)
repeat
· port.dec(1)
· waitcnt(6_000_000+cnt)
port.stop

The values I see at the terminal are 0=144 , 1=145 , 2=146 etc etc so the values are incrementing by one but not what I would expect.·Are there any ideas on what I am doing wrong.

I have seen other serial objects in the object exchange and will be trying them soon I wanted to get by this one first.

thanks

Jeff T.

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-10-24 21:26
    What is your crystal setting?
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-10-25 05:22
    Hi deSilva, the Propstick has a 5MHz crystal in it's socket, in the code I never specified clock or crystal.

    thanks

    Jeff T.
  • deSilvadeSilva Posts: 2,967
    edited 2007-10-25 06:53
    Oh, dear! So your Propeller is running from the internal RC clock, which allows no defined bit rate. It is close to a miracle that you receive anything at all.
    So please state your crystal and - for 4800 baud - a clockrate of at least 20 MHz (but 80 Mhz would be better of course).

    Also change the wait time: It is best to derive it from the internal variable CLKFRQ which comes to one second.

    I am sure it will work immediately.
    CON
      _CLKMODE = XTAL1 + PLL16X     ' or PLL8X if you want it to run @ power saving 40MHz
      _XINFREQ = 5_000_000
    

    Post Edited (deSilva) : 10/25/2007 5:42:25 PM GMT
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-10-25 08:11
    Hi deSilva, you were absolutely correct , it did work immediately and I thank you.

    Jeff T.
Sign In or Register to comment.