Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

New to the uC

Status
Not open for further replies.

Dr_Doggy

Well-Known Member
hi,

due to a lot of the advice to get to use a uC i have decided to take the leap, since I don't know anything about these and since there are soo many, i have no idea where to even start.

I need to input data and output data control for 4 servos,

So...
1)what would be a good uC for this?
2)How do i wire it; to program, to run?
3)what do i need to program it?
4)what are accessories i will need for it(boards)?
5)which one would be found "in stock" @ digikey?
 
Hey there,

1.) It is recommended to use a PIC or an AVR. However, it depends on the budget and the complexity of the servo system you are building.

2-4.) For the PIC (and AVR) alike, you need a (a) microcontroller programmer (PICKit2/3 for PIC microcontrollers, and the AVRISP - not sure the name for the AVR microcontrollers), (b) a suitable compiler for these microcontrollers and finally to run it (c) a prototype breadboard, some components like a crystal, wires and switches. You may also get a training board for it if you do not want the hassle of assembling the system.

5.) You can do a product search in the DigiKey first to check whether are they in stock or not. Search for "microcontroller" and/or "microcontroller programmer".
 
Many of the modern PICs can be run without crystals. You can stuff one in a bread board. Add a bypass cap to between VDD and VSS, and a pullup resistor between MCLR and VDD. Connect the 5 wires from the pickit2 to VDD VSS PGM GPC and MCL. Then Bob's you uncle.

This setup will let you program run and even debug the program on the chip. What could be sweeter ?
 
1. I would go the pic route as you will get a lot more help on this forum than with AVR.
2. Stick it in a breadboard.
3. A pickit2.
4. None.
5. 16F88 or 18F1320 should manage what you want.

Do you have any programming experience? If so, what language/hardware.

Mike.
 
An Arduino board is a good choice as well (AVR based) they're quiet well supported and there is plenty of reference information for beginners.
 
I like uncle bob!

so i just want to get this straight, all i need is pickit, and i can program it there, then eject the chip to my own circuit board?

With my most recent project i am going to want the chip to read input pulse widths, and output pulse widths(on 4 channels). Which chip would be best?
The language i know best is QBASIC and i am fimilar with vb6.

will this pickit work?
Digi-Key - DV164101-ND (Manufacturer - DV164101)

is this a good chip for me? would it work with the above pickit?

Digi-Key - PIC24FJ16GA002-E/SP-ND (Manufacturer - PIC24FJ16GA002-E/SP)
or:
Digi-Key - DSPIC33FJ12GP201-I/P-ND (Manufacturer - DSPIC33FJ12GP201-I/P)
 
The PICkit programmers are really designed for ICSP (in-circuit serial programming) and don't have any sockets for programming loose chips. Your best bet is to add a 6-pin ICSP connector to your board to make programming easy.
 
Last edited by a moderator:
With my most recent project i am going to want the chip to read input pulse widths, and output pulse widths(on 4 channels). Which chip would be best?

The language i know best is QBASIC and i am fimilar with vb6.
GCBasic is supposed to be QBASIC like, check out the online help file to see if the syntax is agreeable. Swordfish Basic gets good reviews, but limited to 18f's.


NO!!! Pickit 1 has an extremely limited device range. Get the Pickit 2 Digi-Key - PG164120-ND (Manufacturer - PG164120) If you want to play with the very newest chips, then only expect the Pickit 3 to provide support.

I like the 18f4620 for an all-round chip, but they keep coming up with newer, better, and cheaper ones all the time. If having 4 hardware pwm's is important, then the above 16 bit chips may be the answer.
 
Last edited:
If you want to just take it out of the box and start running four servos the same day, get this:
**broken link removed**
and you'll you'll need the USB programmer, which acts as a serial port after you're done programming:
Basic ATOM Nano USB2Serial Adapter
It's $25 for the first, $15 for the next, $40 total. The powerful BASIC compiler/IDE is free for the download. Several sample and demo codes exist on the forum, and the people there will help you develop the software (with some effort on your part!).
A servo command is as simple as:
servo p5, 1200, 20 ; p5 is the pin, 0 is the position, 20 is a repition rate

Put in four lines like that, you're running four servos. Other commands and features are just as easy. There is very little learning curve compared to the other methods mentioned here.
Luck on your project and studies.
kenjj
 
wow, so i got the pikkit and the 18f4620,, along with it came with Microcode studio, I figure that s my platform, i understood most of the demo files,

1) Is there tutorials i can get, what language am i dealing with, is it called microcode?

2) I noticed that each pin had 3 names to it, does that mean I can set up almost all the pins to be data I/O ? how do i set?

3)PORT D is parallel slave port data, can I use this for my PWM inputs & outputs? OR do i need to use pins 16 & 17?

4) could i perhaps get a simple code somewhere to; input one pulse, store it as a variable, then output it,,, and the pins it associates with.?
 
Had a quick read on the MicroCode Studio, which is an IDE for the MELabs PicBasic Pro. So unless you pay the $$$ for their compiler, there will not be any play with the MicroCode studio. Their demo version compiler lets you play with a whole 31 lines of code... Wow:rolleyes:. Please correct me if I'm wrong on this.

There are any number of free code editors, like the Crimson Editor, which essentially do the same thing as MicroCode Studio.

Most servo code uses software, not the hardware PWM output, of a device.
 
um well, I learned basic when i was a kid on the old atari's, , so that may be the best, still this microcode studio seems ok to me, i am just having problems defining my variables and assigning data to pins,

what is the microcode language that i am using called?, enclosed is an example.....


Also am i getting it right that;; ie.. pin21 can be; my PWM input pin, TTL data I/O pin, or an analoug input?
 

Attachments

  • microcode.jpg
    microcode.jpg
    33.7 KB · Views: 194
  • uC.jpg
    uC.jpg
    59.8 KB · Views: 191
  • datasheet.jpg
    datasheet.jpg
    8.7 KB · Views: 189
No chance whatsoever of any kind...

Micro controllers are programmed in three primary languages.
ASM, which is chip specific.
Basic, which is compiler specific and chip specific as well.
C, which is compiler and chip specific as well but allows more ASM like control over the program code. Micro C is basically a hybrid between ASM an C, where basic will take the whole thing out of your hands, but not basic can compete with well written C or ASM code.
 
Last edited:
ok lemmie backup,, i got the pickit for my hexLoader, then i got MPLAB IDE v8.36, and microcode studio, is that right>? what does mplab do?
 
The pickit2 will program 18F's.

What chips work with your compiler is dependent on the compiler. Most compilers work with some/most/all 18F chips.

MPLAB is an IDE or Integrated Development Environment. From it you can compile and program chips. You can also debug using either the MPLAB simulator or your pickit2&PIC as a target.

Some of the other IDE's are nicer then MPLAB but I use it because I can switch compilers and keep the same IDE.
 
that swordfish looks cool, so did another IDE called great cow basic, so I got both, but the cow one is a little basic....

so now with the swordfish, where would i find code to input pwm data on 4 channels, and maybe other tutorials?
 
I don't think you will find an example of 4 channel ppm (pulse proportional modulation) anywhere and you will have to write your own. If you use a port with interrupt on change (Port B) then you will get an interrupt whenever a signal changes. Use the interrupt to time the width of the pulses and then use the other 4 pins to output the new values. I did an example in C showing how to output a servo value. That thread ended up with various examples. clicky. Somewhere I have code to read a pulse but I think that is in C as well.

Mike.
 
Status
Not open for further replies.

Latest threads

Back
Top