Are PICs unlimited ;-)???

PIC 18F14K22 flight controller

So far I have this in the code working and tested:

GPS NEMEA parser for RMC and GGA at 4800 Bd altitude, heading, speed, latitude, longitude full resolution.

SPC01 magnetic compass and air pressure, module processing magnetic heading, pressure based altitude.

MPU6050 6 axis accelerometer processing, attitude 3 axis, accelleration 3 dimensions in g.

10 programmable waypoints programmable special features while flying to those waypoints, like altitude, speed, lights [1], chute...

CORDIC for heading calculation from current positon to next waypoint.

Set home button to zero the air pressure altimeter, calibrate the compass, store the current latitude and longitude.

Data entry switch, to be able to set the waypoint related data via serial link at 4800 Bd.

Waypoints are a linked list, you can move them around by setting 'next' for each one.

Help menu (for me), this takes a few kB text... many many options.

AX25 like 1200 Bd encrypted NRZ serial data generator for downlink to HUD display.

Status reporting RS232 test output at 115200 Bd.

32 bit signed integer math.

This is what 'main' looks like: main_loop: ; activate watchdog clrwdt goto main_loop

LOL

And I have still space left, have not optimized for code size:

root@raspberrypi:~/compile/pantel/gps_pic# jppp18pi -i gps.hex -e -p -Y Loading hex file: Program 15180 bytes at address 0x000000 ID 0 bytes at address 0x200000 Config 14 bytes at address 0x300000 EEPROM 0 bytes at address 0xf00000 Erasing chip. Writing program space. Writing config space. Verifying program space. Verifying config space. Ready.

Yes, PIC asm developed on a Raspberry Pi.

[1]
formatting link
I will use a separate PIC to drive the LEDs, got a bunch of RGB LEDs and will glue those on the wings, so text will be in color, I have space above the waypoint area in this one in EEPROM for some text. There will be a third PIC for servo control...

PICs weight nothing and use no power....

I did it all in C on Raspi, but wanted to see if I could get it in a PIC. Seems I can, with space to spare.

In fact lots of it is test routines, when those are defined out.. who knows... No timers used!

Interesting, there was (or maybe is, dunno) 'Viper' the 'without interrupt' procssor.

formatting link
But this is the 'without main' processor. The 'tick' that keeps it alive is the serial data interrupt from the GPS module. In fact programming is much easier this way, no register conflict between main and interrupt routines, no main and only one interrupt. Did I defeat Viper?

Note to self: Do not post this. ;-)

Reply to
Jan Panteltje
Loading thread data ...

On 30/10/2013 5:28 AM, Jan Panteltje wrote: ... snip ...

Welcome to the world of real processors, instead of those grossly bloated PC type operating systems.

I do all that and more in a measly 8 bit AVR processor, about 30K of code written mostly in Basic.

--
Regards, 

Adrian Jansen           adrianjansen at internode dot on dot net 
Note reply address is invalid, convert address above to machine form.
Reply to
Adrian Jansen

But there are two things that force us in PIC32. USB host hardware and graphical LCD. Our target would be over 128K. There are no AVR over 128K.

Reply to
edward.ming.lee

On a sunny day (Wed, 30 Oct 2013 09:02:05 +1000) it happened Adrian Jansen wrote in :

BASIC is nice because it gives you floating point. BASIC compiler you mean? Else it is slower than a snail on glue...

I only use asm on PICs, my attempt at using C on a PIC 18 was of short duration. I only do gcc C...

Reply to
Jan Panteltje

On a sunny day (Tue, 29 Oct 2013 16:11:14 -0700 (PDT)) it happened snipped-for-privacy@gmail.com wrote in :

Why PIC32 graphical LCD? PIC18 will do:

formatting link
:-)

Actually I ran out of code space on that one... RAM and code space. Using the RAM twice.

Reply to
Jan Panteltje

formatting link

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

so does C and most other HLLs.

Pic32 is MIPS, C probably works much better on that architecure.

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

On a sunny day (30 Oct 2013 09:32:37 GMT) it happened Jasen Betts wrote in :

Oh, yes! I re-programmed my Linksys Wifi access point, recompiled the open source C Linux source and modified it, it runs a MIPS processor, no problems, gcc crosscompiler on the PC. Thing runs busybox.

IIRC MIPS patents were sold to some small company some month ago. I just looked it up, MIPS was bought by Imagination Technologies a few month ago:

formatting link
formatting link

I do not know hat the consequences will be for other users of MIPS.

498 MIPS patents go to a consortium 'Briddge Crossing LCC', that seems to belong to 'Allied Security Trust', and that in turn is owned by : IBM, Intel, Motorola So... ???

Source, in German:

formatting link

So with the big ones getting hold of many of the MIPS patents, some key tech will probably make it into their processors. Will they acquire Microchip? ;-) LOL

Reply to
Jan Panteltje

AVR != AVR32

Reply to
hamilton

Correct. As soon as you leave AVR8, you lose the main advantage of the fab process: low power and wide vcc margin. The rest are the same: AVR32, PIC32 and ARM32. So, our customer simply PICk the PIC.

Reply to
edward.ming.lee

Definitely compiled Basic. I can get faster execution using ASM, but writing it is definitely slower !

--
Regards, 

Adrian Jansen           adrianjansen at internode dot on dot net 
Note reply address is invalid, convert address above to machine form.
Reply to
Adrian Jansen

On a sunny day (Thu, 31 Oct 2013 10:02:10 +1000) it happened Adrian Jansen wrote in :

One of my bosses in the past, director of big company, was also an avid x86 asm programmer, he used to sit next to me and show me how 'easy' x86 asm was. Got all elated when IBM gave him one of the early 386 PCs to test out... Man that was fast, we were amazed (secret setup in his office). I learned from him that (his words) all you need is write a good set of libraries (subroutines), and then asm is as easy or even easier than many other languages. I still do it that way. With all that out of the way it took me 2 weeks to write this, but mainly because I had no clue in the beginning how to divide tasks between the several PICs and maintain timing. Now doing the SPI interfacing with an (according to Microchip errata for this silicon) defective SPI module .. That will be some fun and take some time too. Hey!

This BASIC you use for AVR is it free?

Reply to
Jan Panteltje

Isn't this what C is ?

Standard libraries that work together !?!

Once you have your own set of library routines, porting over to another processor is even easier.

No assembly required !

hamilton

Reply to
hamilton

On a sunny day (Thu, 31 Oct 2013 08:16:30 -0600) it happened hamilton wrote in :

Yes C works that way too, probably all decent languages.

Well try to get a decent libc into a PIC 18F14K22. And there are a thousand more libs. C on micros that are not really suitable for it is better not done.

And on those micros you need to talk to the peripheral hardware all the time, better and easier done from asm.

C is fun on a multitasking platform running Linux. I have done a lot of C programming on my z80 system too. with inline asm all the time.

Whatever.

It is not the language, I speak 4 or 5 real languages, it is what people say in it, Usenet testfies to that ;-)

I remember after I pestered the programming department with the nth type of different micro we all were required to take C lessons. That is when I learned C, company lessons, in the boss time.

Reply to
Jan Panteltje

And stupid BASIC programmers use float for everything, when 8/16/32 bit integers are enough :-)

What is wrong with interpreters ? Java seems to be quite popular ??

Sure it is, if every operation is performed as floating point on an 8 bitter :-).

So what is the big difference between C and PLM-80 ? Both are quite usable with such primitive processors like the 8080.

Modern compilers for 8 bit CPUs are quite good for routine programming, but of course, you need some good in-line assembly capabilities to squeeze out the most of the processor. For instance standard C language does not provide any means to access the carry bit on any processor. Without this, implementing multibyte arithmetic packages is quite ineffective and best done with some assembler instructions.

Reply to
upsidedown

No not free, about $100 or so, with lifetime upgrades and good support both from the developer and the Bascom community.

See

formatting link

--
Regards, 

Adrian Jansen           adrianjansen at internode dot on dot net 
Note reply address is invalid, convert address above to machine form.
Reply to
Adrian Jansen

On a sunny day (Thu, 31 Oct 2013 23:01:36 +0200) it happened snipped-for-privacy@downunder.com wrote in :

It depends on the application. For example for processing the GPS output it makes things easier. I do that in 32 bit signed asm now.

I removed the battery from my Android, and no longer use it. I used to beep me awake at night for no reason I could find. Runs google java IIRC. The development tools are broken too.

Android may be popular, but it is a total leaking insecure incompatible bloated piece of sh*t.

Java looks a bit like C++, and THAT is a crime against humanity! Java then probably is a crime against all life in the universe... :-)

I had (on 5 inch or there about floppy), Software Toolworks C80. That is C for the 8080, could do inline 8080 asm. I used it on the Z80, wrote a huge amount of programs with it, multimedia too, shocking for people at that time, sound editor.. made macros for the Z80 opcodes... :-)

Well, I have now a 32 signed asm library for PIC written by somebody else, it works quite well. if you look at things like 'scope_pic'

formatting link
it does the whole FFT calculation in 32 bit integer. It is a bit like FPGA programming, you select a suitable size for your variables, easy to calculate the errors you will get, and there you go. In scope_pic I used an old floating point C code for FFT, then I rewrote that C code for int32_t, to see how that came out, and then hand coded it in asm, as I had now all test values etc. Did not take long, few evenings. The C code I have left in the asm source at some points in the FFT, commented out, you can see how I diddit.

This plane navigation stuff I am doing now, auto pilot, all in 32 bit signed asm in PIC 18F. There are challenges, and I use small C test programs to test the concepts. CORIC sincos and atan2_sqrt. Now compare that to the size of linking in a libmath in C, or even a freaking sine table, or the the printf() floating standard libraries (and scanf()).

Hey you gotta keep the brain trained at my age, else you get 'hhhhuuuuuh??watsiacomputaaaa eeeeh?

C80 was a nice simple clean compiler, floating point package was optional (I had it), floppy no longer did read back at some point.... Threw away the 5 inch drive too. Do not look back. But a Z80 or 8080 is a hellofalot easier for C than a PIC 18F.

Reply to
Jan Panteltje

On a sunny day (Fri, 01 Nov 2013 08:42:20 +1000) it happened Adrian Jansen wrote in :

Nice, I have bookmarked it, there are applications where it would be very nice to have. I have no AVR experience, but who knows what project is next.

Reply to
Jan Panteltje

The point is that if you need a function that takes a big library, you can remove the functions you don't need or just write it in ASM. The native C can speed up programming a lot versus ASM without adding all kinds of "funny" libs.

Not from my experience, but I have always hated big projects done in ASM

Todays C compilers are close to what you can write in ASM. What's morem, you can port native C from an earlier project on a different processor without hassle. Not possible in ASM.

Cheers

Klaus

Reply to
Klaus Kragelund

Both are a matter of managing the libraries. The more complex/integrated the functions the more bloat.

Probably because they weren't designed/managed properly. I've done some rather large projects in ASM. Worked just fine. I wouldn't do it today, mainly because I don't do programming anymore. Can't spell C. ;-)

Not as easily, though C really has to be written for portability, too.

Reply to
krw

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.