Go to Post Deadlines are part of everyday life. - Steve W [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-07-2002, 00:31
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
Bs2

I am using a BS2 chip to make a demo board for a pneumatics presentation. I'm having a little trouble getting started. The main function that the chip needs to serve is to regulate the pressure using the pressure sensors and a spike relay. I can connect this hardware-wise, but I don't know how to program the chip. Both switches are NC until they reach their max pressure (which is adjustable). Any help would be appreciated.
  #2   Spotlight this post!  
Unread 08-07-2002, 01:39
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
No problem. Are you using the innovationFIRST controllers, or a BS2 by itself? I can help either way, but the program would be drastically different depending on which way you are doing it.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 08-07-2002, 10:45
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
Just the Bs2 along with one of the housing boards. One of the BOE's. The First stamps wouldn't be a problem, but the chip is a little different and I'm not sure how to do the input and output, though I think I have the logic part down
  #4   Spotlight this post!  
Unread 08-07-2002, 12:27
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Basically, if you want something to be an input (like the pressure switch), start with
Code:
Input X
where X is the number of the pin you want to make be an input. Likewise, use
Code:
Output X
for any pins you want to be outputs (relays, PWMs, etc).

Then, the bit variables inX and outX (pre-defined by the BS2, don't worry about declaring them) will represent the states of these pins. For example:
Code:
Output 2
Input 3
out2=0
if (in3=0) then switchIsOff
out2=1
switchIsOff:
Remember, the normal BS2 does NOT use serin/serout for I/O, everything is pin-addressable only. Also, you won't be able to use the Spike relays that we use for FIRST as they are specific to the Isaac32(or 16) controllers.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php

Last edited by rbayer : 08-07-2002 at 12:58.
  #5   Spotlight this post!  
Unread 08-07-2002, 16:47
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
The BS2 is capable of Serin/Serout. there are pins on the chip that correspond to Serial RX and Serial TX (Transmission and Recieving of data). To use a spike relay with one of the bs2's simple the Black wire is a ground wire and the white and red wires are input on the relay. Red for reverse and white for forward. The problem I am having though is that using "Input" requires either a high or a low voltage. If there is no voltage present then the state of InX is apparently random. (Page 155 in the Basic Stamp Manual Ver 2.0) I didn't sound right when I read it, but when I used the Debug function it appeared to be true
  #6   Spotlight this post!  
Unread 08-07-2002, 16:57
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Yes, the BS2 can do Serin/Serout, but without the full Isaac32, there is nothing to Serin/Serout to. The easiest way I can think of for fixing the switch problem is to use a switch with three terminals. Connect to ground for off and +5 for on. Where did you find a pinout of the Spikes? I was looking for it on InnovationFIRST's website, but couldn't find it anywhere. Just curious.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #7   Spotlight this post!  
Unread 08-07-2002, 23:01
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
i couldn't find it either. So i just played a little on a low voltage until I found it. Note: It must be grounded to work. Do you have to use the input statement or just the InX after you declared it once? I think this code should work, have tried it yet because I can't find a 9 pin serial cable. Does it sound right?


Input 0 'Low Pressure Setting for Minimum Pressure
Input 1 'High Pressure Setting for Maximum Pressure
Output 2
LastState VAR byte
Counter VAR nib
Check: 'If at or below Low pressure then turn on
Counter = Counter + 1
LastState = (LastState << 1) + In0
If Counter < 8 Then Check
Counter = 0
if LastState = 255 Then Run '8 in a row have been on (not Random)
LastState = 0
goto Check
Run: 'Run until High Pressure swith is open
if In1 = 0 then Full 'No signal - switch open
Out2 = 1
Goto Run
Full:
Out2 = 0
LastState = 0
goto Check
End

Last edited by nwagers : 08-07-2002 at 23:17.
  #8   Spotlight this post!  
Unread 08-07-2002, 23:12
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
that is correct, you only need to declare the Input and Output once. As far as I can tell, the code looks right to me. If I understand it right, as soon as the pressure falls below the minimum, the pump will turn on and stay on until it reaches maximum. At that point, it will stay off until it drops below the minimum again. Correct? The only thing you might want to do is initialize all your variables (including out2) before starting the main loop.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #9   Spotlight this post!  
Unread 08-07-2002, 23:20
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
Yeah, thats the hardware logic. I made a mistake on the the << operator but I fixed it. I'll probably get around to testing it tomorrow when I can find a cable.
  #10   Spotlight this post!  
Unread 08-07-2002, 23:22
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Good point, I didn't even see that. Oh well...too much work with binary makes the brain go numb...
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #11   Spotlight this post!  
Unread 09-07-2002, 17:42
nwagers nwagers is offline
Registered User
#0240 (Mach Vee)
 
Join Date: Oct 2001
Location: Monroe, MI
Posts: 88
nwagers is an unknown quantity at this point
Send a message via AIM to nwagers Send a message via Yahoo to nwagers
This is the code I ended up using. I connected In0 and In2 to Pin 1 and 3 respectively and set those pins to low. Which solved the problem of the whole random thing. I kinda got the idea from the 3 pole switch idea. I ended up bumping the output to pin 4. The problem with the other code is that it likes to be on 1 more than 0 and gave the illusion that the switches were open.


low 1
low 3
Output 4


Check:
if In0 = 1 then TurnOn
goto Check


TurnOn:
if In2 = 0 then Full
Out4 = 1
Goto TurnOn

Full:
Out4 = 0
goto Check
End
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
initialization program and speed controllers rosebud Programming 15 05-10-2004 03:35
Inertial Navigation System CyberWolf_22 Electrical 19 04-12-2003 17:27
BS2 syntax (PBASIC) on the new controllers? Maybe! Jeremy_Mc Programming 0 25-10-2003 15:00
How long is one stamp loop yangotang Programming 3 23-01-2003 20:36
BS2-SX article on differences from BS2 archiver 2000 0 23-06-2002 22:03


All times are GMT -5. The time now is 02:03.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi