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.

PIC language?

Status
Not open for further replies.
Unless you are doing large production runs why use the 10F and 12F family? Maybe pin count or huge production runs. I have one of two of the 12F on the shelf and have been wanting to play with them but the desire/need has not reached the top of my stack. I used the CCS compiler for 16F code and liked it.

Last summer I wrote an unpublished article that compared the code generated by C18, BoostC and Swordfish. The idea was to show the user how similar they actualy were. I ran into some interesting things.

A comparision article would be a very good thing. Perhaps Bill would like to publish it in JPUG.

If it has not already been said: It is a bad idea to try to optimize C code when using a compiler with an optimizer. Optimizers tend to know how to optimize simple logical code. Tricky C code may be tighter but the generated machine code is often larger.

3v0
 
Unless you are doing large production runs why use the 10F and 12F family? Maybe pin count or huge production runs. I have one of two of the 12F on the shelf and have been wanting to play with them but the desire/need has not reached the top of my stack.

To be honest, because I'm cheap and stuped :(

In more details ... I used to play with electronics some ~10+ years ago, and then I stopped as "bread and butter" job took over 100% of my time (sys development, realtime applications, database systems - i work for mysql now as mysql cluster consultant & developer). Some short time ago (~1year ago) I got some time on my hands and returned back to playing with electronics, brushed up old tools etc.. found that I forgot whole bunch of it and started from scratch... at the time, pic was the most appealing uC to play with, and I found a bunch of samples for 12F and 16F pic's .. so I went and got me a bunch of them in local store, purchased mikroelektronika's tool (easypic4, mikroC) and started playing with it ..
EDIT: I do not use mikroC nor EasyPic almost at all as pickit2 + picc for 16F and C18 for 18F get the job done "faster"

Now, I purchase only 18F (as there is really no real price difference for hobby use, and there are some pretty small 18F's too) but still have bunch of 12F and 16F's .. (think I still have ~50 16F84 :( .. and darn thing was more expensive then 16F268)

hence - I use 12F's and 16F's where I can, just to "use them up" :)

conclusion - yup, /me stuped

Last summer I wrote an unpublished article that compared the code generated by C18, BoostC and Swordfish. The idea was to show the user how similar they actualy were. I ran into some interesting things.
post it post it :) would give me good place to start :)

A comparision article would be a very good thing. Perhaps Bill would like to publish it in JPUG.

let me first write it :)

If it has not already been said: It is a bad idea to try to optimize C code when using a compiler with an optimizer. Optimizers tend to know how to optimize simple logical code. Tricky C code may be tighter but the generated machine code is often larger.

I'm pretty familiar with optimisations, optimisation bug's, compilers etc... as system developer, one must know those things :( sometimes the slower but shorter code is actually going to be faster as it will fit in the cpu cache, on the other hand a simple mistake can slow things down with factor of 10 .. now, with uC's this is bit different, actually, lot different, especially with pic's architecture, and in most cases one do not have to worry about it - but some "general pointers" are good to have when one decide to use one particular compiler.
 
Last edited:
You are a lucky person if you can hold down a high tech job and have enough energy left to play with uC's.

When I was working I had a neat job. I was a software engineer but the lab staff treated all engineers the same and I could request any parts I wanted through them for free. The company encouraged tinkering and was happy to provide the parts and most tools so long as we gave them first shot at whatever we came up with.

Lab stock was a nice little room to visit.

About 15 years ago things changed. The hours got longer and the pressure to get products to market were such that you would either have to be super man or crazy to work on anything outside of work. From what I hear that is quite common.

3v0
 
You are a lucky person if you can hold down a high tech job and have enough energy left to play with uC's.

laws change :) .. I have to have 36 uninterrupted hours of "not working" every week, hence -> free time :), the primary work brings enough doe so I do not have to have a secondary, tertiary ... job .. 8h per day include both work and followup on the "new technologies" so, working in sun is kinda good :D .. I'd say better then in most technology oriented companies.

and really, the uC play keeps me happy, after many years of "sysdev work" one get frustrated as what you did few months ago is already "old news" and you cannot "touch" anything you make .. after many years, what do I have to show for, how to explain to non tech person what I do :) ...

when you build a small jump towards the light robot, it is not much work, not much brains involved, but you can touch it, and when you give it to a nephew he play with it for days (until he try to find what is inside :D :D :D ) ... I do not have enough space around here and if I did, I'd probably do some woodwork or something else completely non-technical, but with limited space, "moving, jumping, squeeking" toys are great fun :) and much better way for spending time then watching TV :)
 
I did woodworking and fancy goldfish.

In my experience the one thing that upsets people most is canceled projects. It sucks when management has you working long hours for months on end and then cancels the project. It is even worse when they explain how due to the last flop you will be working long hours...

I was lucky in that I did not see much of that. I knew people who had not released a project/product in 4 years. That had to hurt.

We have gotten a bit off topic. PIC Languages. There is JAL which I have never tried and forth which is a lot of fun. It is very extensible.
 
tried JAL but missed to see the point :) .. I gave it only 1 day so might missed something

forth .. interesting, but not sure I see the point :) would be easier to write in asm directly :) only if there is some nice forth interpreter for PIC, that would be interesting.

what about interpreters, I know there was some nice basic interpreter for 8051, pretty useful stuff .. I tought about making one for PIC but have no use for it still .. maybe there is one available ?
 
We have gotten a bit off topic. PIC Languages. There is JAL which I have never tried and forth which is a lot of fun. It is very extensible.

I used Forth many years ago, I never liked it at all (but not as much as I hated C) - Forth is a really poor choice for a PIC, as it's a completely stack based language - something PIC's don't have much of.

Forth may have seemed 'extensible' back in the 70's, but Pascal is just as 'extensible' (as is C) - you simply write functions and procedures to add to the language.
 
I used Forth for a while, I thought it was OK.

With regard to to 'C', I think the 'C' stands for C-hinese.

It started out OK years ago, but as it grew it ran out of meaningful symbols.

Sorry Pommie.:rolleyes:
 
:D :D :D :D :D

C is like "universal assembler" :) .. and it just get the job done
as forth is concerned I used it only on calculator .. some HP something while back ..
as for pascal, it is great tool, possibly best for what it is made for - teaching procedural language. It was never supposed to be used as dev tool
 
No, you didn't use Forth, you used RPN (Reverse Polish Notation) - which is the style that Forth uses as well.

nope, it was forth .. and yes i know it uses rpn. I used to write program to calculate some forces acting on something when something .. forgot the whole thing .. but loops, jumps, imput params, output txt .. it was forth .. I learned it from some big heavy book I still probably have somewhere in the house :) .. iirc the HP (I think it was hp) had at least 8K of battery powered ram .. full keyboard .. serial port... and it was pretty darn expensive

EDIT: looked pretty much like this: HP-71B - Wikipedia, the free encyclopedia but I cannot be sure if this is the right model
 
Last edited:
from wiki
... the Forth/Assembler add-in ROM, and the add-in HP-IL controller ...

now, it looked like the on on the pic ...donno if that was the one .. iirc it had 2 lines lcd display, this one has 1 line according to wiki ... but, that was some 15+ years ago .. I got it from fathers friend and used for ~6 months .. if it had forth by default or he purchased the "upgrade" - i have no idea :) ... all I can say that it was a great toy :)

and yes, if you wanted to use it as calculator, you had to use rpn

anyhow, I never liked forth, never understood the point and never used it afterwords
 
With regard to to 'C', I think the 'C' stands for C-hinese.
It started out OK years ago, but as it grew it ran out of meaningful symbols.
Sorry Pommie.:rolleyes:

It's past midnight here and that made me laugh out loud.:D I never thought I would be thought of as a C curmudgeon.:rolleyes: I'm an asm guy and just happen to know C. A few years ago I tried the HiTech C and found it bug ridden and extremely frustrating. However, in the last couple of years the C compilers for Pics have become so much better that it now makes a lot of sense to use them.

I will still advice any newcomer to learn asm or rather learn the register level functionality of the chips as this will give them a greater understanding of the underlying hardware and enable them to write better code in any language.

Mike.
 
Last edited:
When there were no free C compilers or good IDE's forth was good choice. Once the interpreter kernel was programed a RS232 serial link to a PC would allow one to develop and test code interactively. This was far easier then erasing and programming UVPROM memory.

C is for the most part just another procedural language. It is not 'extensible' in the sense that forth is. C code looks and feels like C code.
This link.

I think of forth as a language kit. In forth it is typical to see inline assemblers coded in forth. A set of words are defined which correspond to the processors assembler mnemonics. It is quite easy to write a old school basic interpreter in forth too.

For most programming procedural languages such as C (and BASIC) work well. It is only when you step outside traditional programming boarders that forth becomes a very useful tool. Think AI. One of the most useful features is the ability to have a program extend itself.

As Nigel pointed out forth is a stack language. People have gotten it working on the 16F and 18F chips but the last time I checked they were compiled rather then interpreted. There is a new 18F version called flash forth that uses self writable flash that could be worth looking into.

The TI 9900 family was a very good target.

3v0
 
Last edited:
It's past midnight here and that made me laugh out loud.:D I never thought I would be thought of as a C curmudgeon.:rolleyes: I'm an asm guy and just happen to know C. A few years ago I tried the HiTech C and found it bug ridden and extremely frustrating. However, in the last couple of years the C compilers for Pics have become so much better that it now makes a lot of sense to use them.

I will still advice any newcomer to learn asm or rather learn the register level functionality of the chips as this will give them a greater understanding of the underlying hardware and enable them to write better code in any language.

Mike.

hi Mike,:)
Had to look that up.!
A curmudgeon is a miser or an ill-tempered (and frequently old) person full of stubborn ideas or opinions

Dont use that 'curmudgeon' word in my neck of the woods, loosely translated to colloquial,
I'm often called a miserable old fart.!

Started my 77th Solar orbit yesterday.:)
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top