Shop OBEX P1 Docs P2 Docs Learn Events
A few SX questions — Parallax Forums

A few SX questions

HenkieDHenkieD Posts: 8
edited 2005-10-15 14:59 in General Discussion
Hi everybody,

I'm setting my first steps to the SX. In the past few moths I have been quiet busy with the Stamp, and am very pleased to see now that the SX is also programmable in a higher language like basic...
This makes my life as PLC, VB programmer a lot easier...
To get get to the point...
On my SX I need to "count" a pin state change in a certain time frame.
For the Stamp it's easy

Count pin, time, result

But how or what is the easiest way in SX Key

Second question :

The SX must 'talk' to a stamp, I would like to use flowcontrol to have a proper and reliable communication.
Must I create something like this or is their some assembler that I can add in my
SX/B program?

For receiving :

Main:
· ...do other tasks

Recieve:
·Low CTS
·Serin RX, Baud, dByte, 500, No_Data
·High CTS
·Put idx, dByte
·idx = idx + 1
·Goto Receive

No_Data:
· High CTS
··Goto Main

For sending :

Main:
· ...do other taks

Check_RTS:
· If RTS = OFF then·Send
· Goto Main

Send:
· Get idx, dByte
· Serout TX, Baud, dByte
· idx = idx + 1
· Goto Main


Many thanks in advance...

Henk
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-15 13:43
    SX/B doesn't currently have a COUNT function (maybe we can add it, I'll talk with engineer), but you can add your own functionality through subroutines.· You'll have to decide what resolution and time frame you want.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • HenkieDHenkieD Posts: 8
    edited 2005-10-15 14:02
    Hi Jon,

    It is still not clear for me how I can 'monitor'·a specific pin on time base.
    As far as I understand the Count command, it looks like a sort of time interrupted fuction (or am I wrong).
    Must I use the 'Interrupt...Returnint', and set my timeframe depending on the frequence that the SX is running, or is their another way.
    The project I'm working on is a·color reading device with approx 8 TCS230 sensors, maybe that can help to get an idea of where I'm going to.

    Greetings from eThekwini

    Henk

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-15 14:09
    Nothing in the BASIC Stamp is interrupt driven, so if you can do it with the Stamp you can [noparse][[/noparse]nearly] as easily do it with the SX -- other than creating your own COUNT command. That said, I think the TCS230 is a color-to-frequency converter (it's been a long time since I used it) and you might be able to use PULSIN to derive the frequency.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • HenkieDHenkieD Posts: 8
    edited 2005-10-15 14:31
    Thanx Jon for the quick replies,
    I got hooked up by the time interrupt thing, I'm more used to think cyclically because of my plc programming backgrounds.

    Greetings from eThekwini

    Henk



    (PS : Do you guys ever sleep?)
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-15 14:59
    Why would we sleep when we're having so much fun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.