Help with Language for Complete Novice

Thread Starter

brodders

Joined Jun 22, 2010
3
Good evening,

So I'm a Newbie and a complete Novice needing some guidance with which way to turn.
I'm an older generation electronics engineer self teaching the wonderful playground of Pic micro's.

I bought a book (Pic Projects) it told me to buy Pic Basic (TM) Compiler so I did. £75

I have learnt how to turn on LED's ect using the HIGH, PULSE, PWM etc etc. (Pic 16F84A)
My software recognizes the ' and ignores everything after it.
My software does not recognize ;
My software does not support statements like BSF, MOV, etc etc

What language should I be using and what language have i got?

One final quickie for all you geniuses, I tried to slow the clock speed down replacing a 4meg crystal with a 32khz + 10pf caps; it didn't work.
This question is obviously less important, me trying to run whilst I'm still in the pram.:D

Thank you in advance

brodders:)
 

retched

Joined Dec 5, 2009
5,207
Your 16F84A has a built in oscillator, so your code has to be set up to read the external crystal.

As for the language you are using, you are using PIC BASIC. It is a very powerful programing language for beginners.

If you want to learn more about your PIC and programming languages, visit:
http://www.microchip.com

They manufacture the PIC. You will find other compilers there for other languages such as 'C' and ASM (Assembler)

You can find free compilers and demo compilers on google. Just be sure the compilers you choose can handle the 16F84A.

If I were you, Id stick with picBasic. Im not sure if the non-PRO version handles ASM calls or not.. If it does, you can use calls from within your BASIC code to perform ASM commands.
 

t06afre

Joined May 11, 2009
5,934
You should also ditch the 16f84 chip. Get a newer PIC like the 16f628 or 16f690. They have much more functions, and cost less. The 16f84 can be compared to the lm741 opamp ;). 16f628 is pin compatible with 16f84. You can learn much by porting the 16f84 code to the 16f628
 

rjenkins

Joined Nov 6, 2005
1,013
BSF, MOV are assembly language instructions.

You can downoad the free MPLab programming package from the www.microchip.com site. That supports programming in assembly language and lots of useful stuff like emulating various PICs, allowing single stepping of programs, watching the registers and memory to monitor what is happening as the program runs etc..

A lot of other high-level language packages can also be used from within the MPLab system, giving the same facilities while working in C or Basic (if you have the appropriate compiler).
 

Markd77

Joined Sep 7, 2009
2,806
You might need 100pf caps for the 32KHz crystal. You might also need to change the config. Check the oscillator section and the configuration word section in the datasheet.
 

Thread Starter

brodders

Joined Jun 22, 2010
3
Thank you Retched, to6afre, Rjenkins and Markd77 for all your help; as a beginner I will now try and absorb all of the comments.
Kindest regards bb
:)
 

Harrington

Joined Dec 19, 2009
85
Its a suggestion only but if you can manage try to learn in assembler first then move onto Pic basic or C you will see why when it comes to timing principles

Accurate timing principles depend entirely on number of instructions to execute a procedure

This becomes critical when examining sonar or round trip pulses

Not as easy as you think especially when you are using branch instructions in code example btfss and btfsc "skip if set" , "skip if clear "

Cover the basic theory of a the pic you are working with indirect addressing and direct addressing using the SFR registers

As normal i would begin first with writing basic algorithms doing a flow chart of how your program will work

This is something that if you get into the practice of now before writing code can make coding a lot lot easier than if you don't but again bear in mind that's its a suggestion

I would try and start with the normal switching on and off of led's followed by scanning led's This teaches you how to perform keyboard scanning and other functions

Move on from something like this to table look ups BCD conversion so that you can drive 7 segment displays binary to BCD conversion

After this you might like to attempt something along the lines of driving LCD displays and storing recalling characters contained in the ram of the LCD display

If you can manage this its time to look at bus addressing I2C bus learning how to write to external memory devices

The Pic Basic pro is very good for this ,but still, if you can learn in assembler or at least look at the assembler and debug your code or step through your compiled code using something like Mplab available from microchip.com

This is a typical order that I set for myself to do

I'm still learning myself It takes me all my time to achieve some of this

See attached hope that helps any of you with regards to PIC programing enjoy !! Don't give up keep at it You will pick it up in the end Its practice unfortunately like any other programming
 

Attachments

Top