Programming Pic

Hello,

I would to know what is the better method for programming pic. using basic or C ? or just the assembler ? I looked at mikroC and mikroBasic, and these are a bit confusing software Also I have the Microcontroller book from John Iovine, I tried some of his code and many do not work with the probasic compiler.

ken

Reply to
lerameur
Loading thread data ...

The answer to that is the same as the answer to: "What is the better method for digging a hole? A dental pick, a spade, or a backhoe?" The answer to both questions is: It depends.

--
Rich Webb   Norfolk, VA
Reply to
Rich Webb

Rich Webb a =E9crit :

yes ok I get your point, Bu on the other hand, I have this basic program that does compile under basic compiler. I take the same program and paste in Mikrobasic and it do not recognize half the command...

k
Reply to
lerameur

The problem is that not all compiler use the same language - not all BASICs are equal, similar may be but not equal.

you'll need to review your program ;o)

regards, colin

--
www.minisumo.org.uk

(Remove the "No Spam" to reply by email!)
 Click to see the full signature
Reply to
Colin Durrans

Hi,

but C for Pics is not C for Pics The Hitec-Compiler don't Compile a Sourcecode for a ccs- Compiler.

If your Program greater than as a few bytes, you Should use a C-Compiler.

Programming Pic 16XXXX with more than 2k Program Memory is in assembler a little bit tricky, becaus the Memory is oranized in 2k blocks. You must select the pages manually and it is not a fun to find a wrong or forgotten page-set.

Af switch-Case statement ist in C simple, but in Assembler you don't have fun, if you see the source-Code one year later.

With basic i don't have any experience.

regards Jochen

Reply to
Jochen Rapp

assembler. // maybe the upper ones with lots of memory you could use C but thats about it.

--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
Reply to
Jamie

Best depends on circumstance.

A high level language will often facilitate getting a project done. However, assembly is still really the lingua franca of the PIC world. Everyone speaks it and many communicate ideas in it. Consider the fact that the PIC family manuals and virtually all of their application notes are written in assembly.

Another issue with high level languages is their fragmented market segments. You have a mikroC or a HiTech C question and really only someone who uses that particular compiler can be of real help.

Another issue I find is that as commercial software one is subject to the vagaries of the company offering the software. I guess that's a personal pet peeve.

In any case I would advise taking the time to learn PIC assembly if for nothing else communication and translation purposes.

As for another PIC language to take a look for try JAL. It's a Pascal like language, Open source, and has a pretty large and active community that uses a Yahoo group to interact. They just released a heavily modified second version. You can find the details here:

formatting link

Hope this gives you some ideas.

BAJ

Reply to
Byron A Jeff

Byron A Jeff a =E9crit :

Yup,

I was not sure, but now I will study assembler. Also I was using soem already made program and compiling it with picbasic, found out that picbasic pro is very different and will not compile the same program. pfff anyway , one more question

I got this program fom:

formatting link

main: pause 1000 ' wait for the LCD to startup serout PortB.0,0,[$FE,$01] ' clear the screen serout PortB.0,0,["Wherever you go"] ' send string "Wherever you go" serout PortB.0,0,[$FE,$C0] ' move the cursor to the 2nd line serout PortB.0,0,[" there you are "] ' send string " there you are " pause 1000 ' pause for a second goto main ' loop

I hooked up the LCD and I get nothingIt does power on the LCD but nothing happens. I was not sure about the serial line (just had 16 connection on top of the LCD) But I tried them out and nothing. Any ideas ? I test the chip and burner with blinking led so it does work and my steps are good. Just thought the program might be off. bt it does compile Also I use only three wires to the lcd.

k
Reply to
lerameur

Good. It's good to have at least a reading level understanding.

Sure. That program i for a serial LCD. A serial LCD is an LCD display that's hooked up to a controller (like a PIC) that takes serial commands as input and talks to the LCD.

You however have a bare LCD. So you need a different program to make it go.

BTW you can find the serial LCD module that this program drives here:

formatting link

A PICbasic pro program to drive a bare LCD display in 4 bit mode can be found here:

formatting link

Hope this helps.

BAJ

Reply to
Byron A Jeff

If you're using the PICBasic Pro compiler, (which I've used for many years now, mainly for the 'F84(A) and 'F876(A) chips), then you only need to use the "lcdout" command to write to a standard Hitachi 44780U compatible LCD display.

e.g. To clear the display and write "Hello World"on the top line of a 2-line x 16-character display , you would use the following:-

lcdout $fe,1,"Hello World"

Then, to write "How are you?" on the second line:-

lcdout $fe,$c0, "How are you?"

or, to do it all in one program line:-

lcdout $fe,1,"Hello World",$fe,$c0,"How are you?"

The "lcdout" command is a part of the standard PICBasic Pro libraries and requires no additional code or includes, apart from the standard LCD defines as described in the manual. For example, the defines to connect a 2-line x 16-character LCD in 4-bit mode, with PORTB.0 to PORTB.3 for the data lines, PORTB.4 for the EN and PORTB.5 for the RS are as follows:- (Note that in 4-bit mode, the LCD's D0-D3 are unused and D4-D7 connect to the PIC's PORTB.0 to PORTB.3)

' Set up LCD:- DEFINE LCD_DREG PORTB ' LCD data on PortB. DEFINE LCD_DBIT 0 ' Data on RB0-RB3. DEFINE LCD_EREG PORTB ' Enable on PortB. DEFINE LCD_EBIT 4 ' EN on RA4. DEFINE LCD_RSREG PORTB ' Register-select on PortB. DEFINE LCD_RSBIT 5 ' RS on RB5. DEFINE LCD_BITS 4 ' 4-bit data bus. DEFINE LCD_LINES 2 ' 2-line LCD display.

These defines should be placed near the top of your code. Incidentally, I agree that it's also necessary to learn assembly language for these things, for an understanding of what's going on, even if you use higher-level languages. Also, I use PICBasic Pro from inside the Microchip MPLAB IDE, which allows you to use the MPLAB-SIM simulator, a debugger and a stop-watch etc. while developing your code. MPLAB is a free download available from the Microchip website. It is very large, but well worth the time and effort.

... Steve

Reply to
SDC

Thank you Steve,

i took an assembly for pic out of my library and I reading it like crazy now. Probably be better to finish that befire doing something else. I find hat I missed a lot o important details. after that i will try your program for sure. I am still trying to find a web site where they give you the scematic of a device that would allow me to make my lcd serial. do you know of any ? I know of

formatting link
but they have a prepogram chip that they only sell

k

SDC a =E9crit :

ine

bit

if

c=2E

Thank you Steve,

i took an assembly for pic out of my library and I reading it like crazy now. Probably be better to finish that befire doing something else. I find hat I missed a lot o important details. after that i will try your program for sure. I am still trying to find a web site where they give you the scematic of a device that would allow me to make my lcd serial. do you know of any ? I know of

formatting link
but they have a prepogram chip that they only sell

k
Reply to
lerameur

"lerameur" schreef in bericht news: snipped-for-privacy@i42g2000cwa.googlegroups.com... Thank you Steve,

i took an assembly for pic out of my library and I reading it like crazy now. Probably be better to finish that befire doing something else. I find hat I missed a lot o important details. after that i will try your program for sure. I am still trying to find a web site where they give you the scematic of a device that would allow me to make my lcd serial. do you know of any ? I know of

formatting link
but they have a prepogram chip that they only sell

k

Once you can program a PIC you can easily make one yourself :)

petrus bitbyter

Reply to
petrus bitbyter

Interesting that you wrote this question because I just wrote some notes on it. Personally I like using C because I can read it and it is fairly standardized although as some others have said you have to adjust it for different compilers. They are also right that basic is less standardized and is more difficult to port to a different compiler. I find assembler just too much trouble (unless I really really need to use it).

Anyway the article I wrote is at:

formatting link

Also later on in this thread is a request for making a serial LCD display. You can find a project with full source code, documentation and schematic here:

formatting link

It uses a PIC as the serial receiver.

Hope that helps

John

Reply to
jfm

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.