Go to Post Pompous boasts dont get you anywhere. Results get your name on the book... - Jeremy_Mc [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Spotlight this post!  
Unread 16-01-2002, 23:07
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Quote:
Originally posted by Joseph F

...
This may work. I'm not exactly sure about negations in pbasic. It could end up attempting to put in a negative... Use it at your own risk.
...
Uhhh.... that's not a negative sign (unary operator). That's a tilde (inverse operator).

Say you have a value of 0 (binary 00000000). The inverse sign inverses all the bits to 255 (11111111). Simplest way of doing it.

Example: 00010100 = ~11101011


Same concept for toggling relays....
Example:
relay_solenoid var bit
relay_solenoid = 0 'solenoid should be deactivated
relay_solenoid = ~relay_solenoid ' toggle the solenoid state

This code is simpler than using if-then statements to check the current state of the bit. All you're doing is altering it.


Suggestion is to read the stamp manual. I did and I learned more than I ever wanted to know about the PBASIC programming language. Just head over to The PBASIC programming manual and check it out. Be careful, it's 2 mb.

Last edited by Jnadke : 16-01-2002 at 23:16.
 


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
how do i control a piston with a joystick Ryan Foley Programming 2 27-05-2003 17:13
Fried program slots? Jeff Waegelin Programming 18 19-03-2003 18:08
question about one joystick drive programing james700 Programming 13 29-01-2003 14:49
robot goes haywire with the one joystick default code Miles Programming 7 24-01-2003 14:58
joystick problem archiver 2000 12 23-06-2002 23:08


All times are GMT -5. The time now is 05:35.

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