microcontroller programming -- how to begin

I have this microcontroller

formatting link

it is basically their Cubloc 280 with the relay board and set screw terminals attached.

When I get it, I would like to, first, just play with it a little bit, write some hello world types of applications, etc. Do you know of any websites that discuss how would discuss how one gets started with microcontrollers. I am a computer programmer, so programming as such is not a problem, but controlling a microcontroller seems to be a different paradign from just writing "apps".

i
Reply to
Ignoramus5457
Loading thread data ...

That documentation doesn't say much. Looks like an 'orphan' micro with a 'unique' programming language - a real 'learning' experience.

Good luck, you'll need it. Luhan

Reply to
Luhan

Well, they have a big PDF file with documentation on the processor C280, how to program it, how to read inputs etc. It is a separate PDF file, it can be seen here:

formatting link

That thing is programmed in Basic or in Ladder Logic.

i
Reply to
Ignoramus5457

Ugh, get the AVR butterfly starter, spread your wings a bit, live on the embedded "Dark Side", and its cheap, tons of free tools around

martin

Reply to
martin griffith

I don't think AVR (based on the ancient 8051 which is closer to its

40th birthday than its 30th) is a very good place to start. It works, but somewhere down the road you'll discover C isn't portable between platforms which have split memory areas.
--
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vindt U op www.adresboekje.nl
Reply to
Nico Coesel

I am not too worried that I have to use BASIC. How do people write these things in general? Do they have a main loop and a state machine?

What about timings, looks like this C280 does not have a built in timer. And yet sometimes I need to do things for a certain time (such as open gas valve before starting TIG welding), but they can be interrupted, by, say, releasing foot pedal.

Am I stuck with having to use a counter sensor and external oscillator?

i
Reply to
Ignoramus5457

formatting link
Their internal architecture was conceived by two students: Alf-Egil Bogen and Vergard Wollan, at the Norwegian Institute of Technology (NTH) and seems to have a lot of features.

martin

Reply to
martin griffith

One should be familiar with this CB220 to answer your questions... or read the manual. Guess you can do the latter yourself.

petrus bitbyter

Reply to
petrus bitbyter

Have you looked at the manual?

It's an odd beastie. I never heard of ladder logic before, but seems to be a combinational logic on inputs that happens in realtime. Equivalent to stringing a bunch of switches in series/parallel strings.

On its basic-language side it has OnTimer() which lets you set an interrupt period down to 20 mS. I would think this should be enough for your interval issues.

You need to download their development environment to program the thing.

Doesn't seem like it has much memory, but hopefully enough for your welder needs. Has built-in AD and DA and PWM so that's helpful.

I probably would have done it with a PIC or something, but I've done that before so I know where to start.

Good luck.

Reply to
xray

Yes, I am reading it.

Yes, seems to be similar to putting together a bunch of relays.

I think that you are right.

I would write a big event loop and make a case statement based on my state (an enumeration).

Did that already.

Yes, I think that it is suitable for me.

i
Reply to
Ignoramus5457

You won't learn much about microcontrollers that way though.

Yes.

Sometimes. Sometimes several in fact.

Graham

Reply to
Pooh Bear

The usual language is C or C++. Some use an OS, some don't. I usually don't use an OS and have a loop in the main function which calls a main routine for all modules. This keeps functionality seperated yet has very little overhead.

On the other hand, there are also PLCs which are industrial machine controllers. These have very limited functionality (throwing switches based on a combination of input states and / or time), but they may be more appropriate for what you want to build.

The manual should answer all these questions.

--
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vindt U op www.adresboekje.nl
Reply to
Nico Coesel

That's exactly what it is, or, more accurately, where it came from. PLCs use it to substitute for huge panels of relays. I did a quick google:

formatting link

One of them even calls it "Relay Ladder Logic". :-)

I'm just guessing, but your ladder logic mode probably has some kind of timer(s) available; I ass-u-me that that would be in the manual somewhere.

Cheers! Rich

Reply to
Rich Grise

Pretty clean link. I'd only change 1 thing. To make it Google-searchable, you could put a plus sign between the %22 and the first search term:

formatting link
. Of course, that makes the link LONGER. To make the shortest possible link, use a hyphen:
formatting link

Note: This will also find ladderlogic.

Reply to
JeffM

A general approach to bringing up a new processor is the embedded equivalent of "Hello, world!" of simply making one specified output pin toggle at an intended rate. If available, having a one of the chip's timer/counters do the timing along with an interrupt service routine is recommended.

Simple as this exercise is, it requires getting a working toolchain setup and running, an understanding of the architecture and its coding, correctly getting the working code onto the chip, and feeding the chip the clocks, resets, and voltages that it wants.

Once that's done, the rest is "just programming."

--
Rich Webb   Norfolk, VA
Reply to
Rich Webb

Funnily enough I have a file called flashled.p51 which compiles to flashled.hex.! A good simple way of proving you're making things waggle correctly.

Very true. It proves more than at first sight you might think.

Yup. LOL @ 'just'.

Graham

Reply to
Pooh Bear

I agree, I think that the main thing is to get started, the rest should be just programming. There is no big realtime issue here as well, if I can do the right things without 1/20 of a second, I will be fine.

i
Reply to
Ignoramus5457

Maybe, but my goal is to just get this welder to work in a flexible fashion, doing many things (CC, CV, TIG, plasma etc).

good

Sure, here I need only one though.

So, the loop will be something like, if it was in C

const int preflowDuration = 10; // startup state = WAITING; // ... // ///////

while( true ) {

if( state == WAITING ) { if( weldingToggleSwitch == ON ) { if( processSelector() == TIG ) { state = TIG_PREFLOW; preflowStartTime = time(0); gasWaterSolenoidRelay.turnOn(); } ... } } elsif( state == TIG_PREFLOW ) { if( weldingToggleSwitch == OFF ) { // weld canceled state = WAITING; gasWaterSolenoidRelay.turnOff(); } elsif( time(0) - preflowStartTime > preflowDuration ) { // preflow done state = TIG_WELD; weldStartTime = time( 0 ); // needed for computing postflow weldCurrentRelay.turnOn(); } ... }

...

sleep( 0.05 ); // sleep 1/20 sec. }

etc etc.

Makes sense? I can write such code all day long. Too bad that it is BASIC and not C++, but I can live with it.

i
Reply to
Ignoramus5457

I am sure that it is the case. I have not yet gotten to reading about ladder logic, yet.

i
Reply to
Ignoramus5457

In my case the main loop starts and finishes.....

main : ( procedure );

do while TRUE; ( I use caps for stuff like logical operators and registers for example and everything else is lower case ) ................. stuff here.............. end;

or end ( main); if I was feeling pedantic.

It's PL/M ( 51 ) btw.

Graham

Reply to
Pooh Bear

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.