Maker Pro
Maker Pro

Programming Pic

L

lerameur

Jan 1, 1970
0
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
 
R

Rich Webb

Jan 1, 1970
0
Hello,

I would to know what is the better method for programming pic.
using basic or C ? or just the assembler ?

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.
 
L

lerameur

Jan 1, 1970
0
Rich Webb a écrit :
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.


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
 
C

Colin Durrans

Jan 1, 1970
0
lerameur said:
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...

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
 
J

Jochen Rapp

Jan 1, 1970
0
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
 
J

Jamie

Jan 1, 1970
0
lerameur said:
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
assembler.
//
maybe the upper ones with lots of memory you could
use C but thats about it.
 
B

Byron A Jeff

Jan 1, 1970
0
Hello,

I would to know what is the better method for programming pic.
using basic or C ? or just the assembler ?

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.
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.

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:

http://pic.flappie.nl

Hope this gives you some ideas.

BAJ
 
L

lerameur

Jan 1, 1970
0
Byron A Jeff a écrit :
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:

http://pic.flappie.nl

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: http://www.imagesco.com/articles/lcd/05.html

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
 
B

Byron A Jeff

Jan 1, 1970
0
Byron A Jeff a =E9crit :
I was not sure, but now I will study assembler.

Good. It's good to have at least a reading level understanding.
Also I was using some 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: http://www.imagesco.com/articles/lcd/05.html

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 ?

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:

http://www.imagesco.com/microcontroller/lcd.html

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

http://www.melabs.com/resources/samples/pbp/lcd.bas

Hope this helps.

BAJ
 
S

SDC

Jan 1, 1970
0
Byron A Jeff said:
Byron A Jeff a =E9crit :
I was not sure, but now I will study assembler.

Good. It's good to have at least a reading level understanding.
Also I was using some 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: http://www.imagesco.com/articles/lcd/05.html

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 ?

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:

http://www.imagesco.com/microcontroller/lcd.html

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

http://www.melabs.com/resources/samples/pbp/lcd.bas

Hope this helps.

BAJ

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
 
L

lerameur

Jan 1, 1970
0
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 http://www.wulfden.org/k107/index.shtml but they have a
prepogram chip that they only sell


k


SDC a écrit :
Byron A Jeff said:
Byron A Jeff a =E9crit :

I was not sure, but now I will study assembler.

Good. It's good to have at least a reading level understanding.
Also I was using some 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: http://www.imagesco.com/articles/lcd/05.html

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 ?

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:

http://www.imagesco.com/microcontroller/lcd.html

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

http://www.melabs.com/resources/samples/pbp/lcd.bas

Hope this helps.

BAJ

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

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 http://www.wulfden.org/k107/index.shtml but they have a
prepogram chip that they only sell


k
 
P

petrus bitbyter

Jan 1, 1970
0
"lerameur" <[email protected]> schreef in bericht
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 http://www.wulfden.org/k107/index.shtml but they have a
prepogram chip that they only sell


k

<snip>

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

petrus bitbyter
 
J

jfm

Jan 1, 1970
0
lerameur said:
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

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:

http://www.best-microcontroller-projects.com/article-programming-a-microcontroller.html

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:

http://www.best-microcontroller-projects.com/serial-lcd.html

It uses a PIC as the serial receiver.

Hope that helps

John
 
Top