Everything is in the coding style... using internal registers or few lines of code instead of some statements like pre-made ADCIN,BUTTON, HPWM and many other helps really... just be friends with Datasheets... everything is in.
Everything is in the coding style... using internal registers or few lines of code instead of some statements like pre-made ADCIN,BUTTON, HPWM and many other helps really... just be friends with Datasheets... everything is in.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
there is a big problem with mixing assembly with PBP, many times when we use PBP we have no idea which registers PBP changes so when you do assembly that uses those registers things go wacky. For example if you use HPWM and want to use TMR2 for a counter driven interrupt things can screw up.
If you read the DATASHEET you will discover that the PIC requires use of TMR2 for timing PWM functions. If you used Assembler with Hardware PWM you would still need to use TMR2 - there's no escaping it. There are no secrets regarding what PBP does or doesn't do to registers behind the scenes - it's all in the DATASHEET if only people bothered to look at them for anything more than the pinout diagram.
ok, were not having a dig here, i just wanted to find out whether it was worth with sticking with learning C for pic or just stick with the nice and simple picbasic.
cheers everyone
phil
I agree though, people should understand the processor they are using at a level deeper than the basic programming langauge, we aren't programming away on glorified 3 million man hour operating systems that we can take comfert in knowing it will stop us from doing things too stupid. But that is just lazyness and doesn't really answer the question "is picbasic good enough", in a word or so the answer is forty-two. The important thing here is the question. No not 7 times 6, "is picbasic good enough for what?". You decide, depends on your programming ability, and your task. as a defence for C, in my opinion it is just as easy to write in as Basic, and I have yet to meet a C compiler that doesn't have a slew of I/O functions. or a useable debugger, but that said I wouldn't want to plop someone infront of a C compiler that doesnt' know A) anything about the chip and B) C language. where as basic, I could get my unborn nefew to write me up a simple program, (well in a few years, when he learns a little bit of english.)
- my only suggestion, would be to include a little more code optimization at complie time (I am not even sure if there is any)
Twasnow
Like riding a bike your first time - it's only hard or intimidating until you learn it. C is similar to BASIC in many ways, but it does have a much longer learning curve.
I recommend you learn assembly at some point also since you can drop-in .asm routines that will speed things up where canned functions aren't an option.
C is a lot of fun, and a good C compiler offers a lot of built-in goodies you just won't find in any BASIC compiler, but the BASIC language is hands-down the easiest to start with & see immediate results.
The BASIC Stamp is a good indicator. Lots of folks get started with the Stamp then migrate to more powerful (and much less expensive) alternatives like the PIC & BASIC compilers.
Part of my job is evaluating compilers. PBP & Proton+ are the best (IMO) at present. CCS & Hi-Tech in the C category - with CCS being the best for beginners. Tons of examples with CCS to get you started.
The Parallax Inc."Basic Stamp" is a wonderful product for beginners.
The Parallax Stamps in Class™ Education materials is great.
The large majority of the new Micro Engineering Labs customers are
also Parallax Inc. customers. The success of the PicBasic compiler is
directly related to the success of the Basic Stamp module.
If one day a Basic Stamp user will not feel at home immediately with
the PicBasic compiler, then that day will be the end of the easy
customers acquisition for Micro Engineering Labs. The PicBasic
compiler will never lose its ties with the Parallax PBasic language.
The PicBasic compiler is a great tool for the hobbyist, experimenter
and professional. This compiler greatly reduces the software
development time and the learning curve.
Yes, Picbasic is good enough!
Luciano
Here is an example where you wouldn't want to use picbasic. at least I wouldn't.
1) I am currently controlling DC 2 motors via an H-Bridge, each motor requires 3 outputs from the pic, Enable and two direction (both directions are needed for quick stop) I have to output two PWM's each are dynamic in pulse-width, depending on a speed selection for each motor, and an encoder feedback to ensure they go at the required speed, or to compare the two motors to ensure they rotate the same amount. The encoders are each pulsing up to an average of 2 KHz. The PWM pulses are output at a frequency of approx 4Khz. Every 200 pulses I recieve from the encoders (100 ms), I update the PWM. I get the commands (speed/direction for each motor) from another PIC via a 4bit bus that is also read every 100ms, I also output a status pulse when a task is complete.
now maybe you could do this with basic, but I wasn't even going to try, I wrote this in ASM, but hey if I am wrong plesae correct me.
Bookmarks