Hello Guest it is March 28, 2024, 10:14:00 AM

Author Topic: Serial port I/O wizards needed  (Read 3315 times)

0 Members and 1 Guest are viewing this topic.

Offline Zaae

*
  •  120 120
    • View Profile
Serial port I/O wizards needed
« on: June 15, 2010, 09:23:23 PM »
I've done a lot of reading around here on the topic, but still have questions.  I have a Parallax Basic Stamp here I'm playing with, and I was able to get some simple communications going using an output from a mach3 script:

Call sendserial("test")

This works, but I'm wondering if there's a readserial counterpart, or something similar? I need to read data back from the serial port as well.

I've been fiddling with getfifoentry()  and sendfifo(), but not having any luck getting any communications going with it.

Thanks :)

Offline Zaae

*
  •  120 120
    • View Profile
Re: Serial port I/O wizards needed
« Reply #1 on: June 16, 2010, 10:28:41 AM »
Also, I've been working with the basic stamp to communicate with mach 3.

This is a very simple version of what I'm working on in the basic stamp code.

Code: [Select]
' {$STAMP BS2}
' {$PBASIC 2.5}

sData VAR Byte
insignal VAR Byte

DO

  SERIN 16, $4054, [sData]   ' 4800 baud
  insignal = sData -48 ' the incoming data is a character decimal value, so -48 to get the true number (not the best way, I'm sure)

TOGGLE insignal

LOOP

STOP


A moderator from the basic stamp forum says:
Quote
The stamps use a signal from the serial port to reset them (I think it is DTR).
You need to make sure that signal stays in the correct state (low I think) otherwise it will reset the stamp.

I need to figure out how to control the serial output from mach3 to keep the basic stamp from resetting after each incoming data being sent.

Sorry this is so short, and lacking in detail, I need to head to town.
Thanks :)
Z

Offline Zaae

*
  •  120 120
    • View Profile
Re: Serial port I/O wizards needed
« Reply #2 on: June 16, 2010, 02:08:12 PM »
Nevermind the post above, I worked out how to stop the DTR pin resetting the basic stamp.

We made a male to female serial adapter with a momentary push button in line with the DTR pin. You have to hold the button down to send the program to the BS2, but the opening / closing of the port that I can't control from within mach doesn't have any effect then.

I know that this info probably isn't really useful to most folks, but I hate finding a post that has a problem just like mine, but the poster doesn't follow up and let people know what worked in the end.  :)

I am still wondering about reading data from the serial port though. I suspect it will end up being something with the modbus, but I don't have time to play with that right now.

The goal of all of this is that the basic stamp allows me 16 extra I/O pins, plus I can enter code into the basic stamp to deal with each pin.
« Last Edit: June 16, 2010, 02:11:23 PM by Zaaephod »

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Serial port I/O wizards needed
« Reply #3 on: June 17, 2010, 02:46:39 AM »
Hi Z,

Sounds an interesting project.
Thanks for posting the info.

Tweakie.
PEACE