November 22, 2024, 08:26:11 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Out Put Type

Started by Desert_gold_hound, November 03, 2008, 10:44:56 AM

Previous topic - Next topic

Desert_gold_hound

November 03, 2008, 10:44:56 AM Last Edit: November 03, 2008, 11:10:52 AM by Desert_gold_hound
Can this card be transformed from digital to analog? What I need is to move a servo to a specific position and not just ON/OFF. If not then what are my options?

I am kind of new to electronics but do understand the basics.

My other question is on the programming end of things.

While looking through some of your programming examples I see they use the dreded GOTO command. I prefer object oriented programming is this an option?  If not is this in the works to where it may be available in the near future?


I am still planning on using your cards it's just that I need to know my options. I do plan on making my own cards for some projects but I don't really feel like developing my boards at this point and would still be stuck with the same types of chips. So being that yours are already made and will do the same thing mine could why reinvent the wheel. I am glad you have these boards available.


As a programming example lets say I needed to call an event if input 0 was activated then I would call on an output event on output 1

Say something like this.

main
{
     if(pin0 == true)
     {
          skeleton1Speak();
     }
}
skeleton1Speak
{
     pin1 = on;
     pin1 = off;
     pin1 = on;
     pin1 = off;
     pause 200;
    pin1 = on;
}

I didn't do this in any real language just triing to give you the drift of what I am wonting. I need it to call events and not jump around the main code. This way its easyer to read through the programming. This would make life so much easyer. 



JonnyMac

The Prop-SX uses the Parallax SX28 processor so you have two Parallax supported options: Assembly and SX/B.  SX/B is a variant of BASIC that I helped create and therefore and a particular affinity for. 

Let's get this out of the way, shall we.  GOTO is a four-letter word but is not bad.  Many OOP snobs will have you believe otherwise, but here's the truth: OOP simply buries what the processor does with GOTO.  For example, you might prefer this stucture:

Main:
  DO
    ' program statements
  LOOP


Okay, that's fine, and I use DO-LOOP when the number of programming statements is limited so that I don't get lost.  Here's the hidden fact: the compiler creates labels at DO and LOOP, and the code at LOOP is the assembly equivalent of GOTO!  Coding is coding; and OOP doesn't make for better programs -- in fact, most programmers don't understand OOP concepts and end up writing horribly inefficient code, especially when attempting OOP for embedded control.  All right, I'll jump of my soap box now.

The Prop-SX can handle servos with no trouble.  The best idea is to use a "virtual peripheral" servo driver to keep your servos updated while waiting on an input.  You'll find examples in the library of servo drivers we've written for the Prop-SX.  And with SX/B you can write subroutines and functions that are called without using GOTO.
Jon McPhalen
EFX-TEK Hollywood Office

Desert_gold_hound

November 03, 2008, 01:32:06 PM #2 Last Edit: November 03, 2008, 01:37:58 PM by Desert_gold_hound
Yea I am one of those object oriented snobs LOL

I prefer to use child, parent, and grand parent type of objects. This way I can use the same code with multiple similar output/input types of choices.

I can deal with goto commands it just makes reading through a bit harder for me then if I make everything a separate object. This could be debated over and over though just like what the best language is c, c#, pearl, basic,.... I personally like c# because I know it best. That is also the reason I like OOP is because I am used to it and it's not because I downgrade one over the other.

I will look into the code you mentioned for the servos and see what I think. Looking at "good code" is the easiest way for me to learn a new language anyways so this will help. Luckily once you know one language the rest are easy to learn LOL. This will be the first time I will be programming for components I have always dealt with computer related things only. Such as business applications and such.

I look forward to learning and hope that I can help/teach someone else what I learn along the way. This should be an interesting subject for me.


One last question if I make boards to interface with yours am I allowed to post them in here? Not talking selling simple giving examples of what I am trying to accomplish with it.



EDIT: Just relised you said I DON'T NEED to use the GOTO at the end. YIPPY! That will make it easyer.

JonnyMac

Just keep in mind that OOP concepts work fine in PCs with loads of horsepower and resources; they don't work well at all when it comes to embedded processors with limited horsepower and resources.  Still, good coding is good coding -- for the intended target.  I have lots of code that I reuse in my SX projects that has proven to be reliable time and time again.  It's not OO, but it works... and GOTOs are only used when appropriate.  SX/B is a much more modern dialect of BASIC that IBM BASICA that gave BASIC such a bad reputation.
Jon McPhalen
EFX-TEK Hollywood Office

Desert_gold_hound

Quote from: JonnyMac on November 03, 2008, 06:06:56 PM
Just keep in mind that OOP concepts work fine in PCs with loads of horsepower and resources; they don't work well at all when it comes to embedded processors with limited horsepower and resources. 

Good to know and makes alot of sence. TY.

I will be making my first order in a week or two. I have to figure out recources before I figure out the purches to make.