Picaxe 32 bitter

GrahamGo

Senior Member
I am just curious, the Picaxe approach is just great. But will the concept ever be applied to provide a newer generation 32 bit family? The PIC32 being an obvious choice. But a downside about the PIC32 are the high pin counts, I think 28 pin is the smallest DIP version?. Whereas the ARM family is available down to 8pin DIP which I have used.
 

hippy

Technical Support
Staff member
PICAXE firmware may one day run on other Microchip silicon, including 32-bit, 64-bit and anything else they can come up with. It is mostly a matter of having good reason and a business case for adding new devices to the PICAXE range which justifies the effort involved.
 

stan74

Senior Member
A rpi has a 64bit processor but everything is interpreted python. freebasic compiled code runs 100 times faster. Picaxe needs a real compiler and could be ahead if a real 32 bit compiler was written but picaxe has it's established user base to maintain and if that base isn't demanding then why change things. Home hobbyists are in the minority but I haven't done a head count. For years it seem in the forum,before the x2 series,will x2 be 32bit? Will picaxe generate assembler? Instead of waiting...move on but why? Unless you are trying to update a graphic display or something that needs to be that fast then why are people asking for more. Like how many people want to use freebasic on a rpi...apart from basic being easier than python for many and being compiled 100 times faster..(rpi python is slow).
There's other stuff trying to get into uk ed with blocky basic for pic / avr. Remember the bbc micro.
 

Goeytex

Senior Member
Having the business case is the key point IMO

Schools are on tight budgets, and many hobbyists so tight that they would rather jump through hoops trying to get an 8-pin Picaxe to do the job of a 20-pin than to spend the extra dollar/quid for the right chip ... My guess is that there would be a very very small market and little if any return on investment.

It also seems to me that using Interpreted BASIC on a 32 or 64-bit processor is kinda like having a Ferrari fitted with bicycle wheels and a rev limiter.
 

srnet

Senior Member
My guess is that there would be a very very small market and little if any return on investment.
I would agree, and we should also assume that Rev Ed also understand their market a lot better than any of us do ...................................
 

GrahamGo

Senior Member
@Goeytex I smiled at this, because it sounds just like me (cheap!). Also, as @stan74 wrote, at my first exposure to Picaxe I got disillusioned, because I tried to write some code for a very simple graphics display it was just too slow. I gave up on it. But since then recognize what the Picaxe is good at and have used it several times quite successfully.

Today I have been playing with Forth installed in a TI MSP430 running at 8 mh/z. I am pretty familiar with Forth and post this for info for anyone that might not be familiar with the Forth environment and need some speed at no cost. The Forth takes about 8kb of Flash. The code below is all high level Forth and I just typed it in and tested it. The comments were added later before posting here to help clarify things. I could have used a PIC, but I dont have one available.

The code simply initializes Port1 and then pulses the Red Led on and off 10 times. I had to add the 4 microsecond delay because the logic probe kept missing the pulses. As you see on the trace the Ledon time is about 6us and LEDoff time about 2us. This includes several call and returns, and so is pretty impressive. Only needing a USB serial connection and the forth interpreter/compiler built into the MSP430.

compiletoflash ok.

$22 constant P1DIR ok. \ Port 1 direction
$21 constant P1OUT ok. \ Port 1 Output

: us 0 ?do [ $3C00 , ] loop ; ok. \ n-- Approximate micro sec delay
: MS 0 do 998 us loop ; ok. \ n-- Approximate MS delay

1 p1dir cbis! ok. \ n-- Set Port 1 bit 0 to output mode

: LedOn 1 p1out cbis! ; ok. \ -- Turns Red Led on (set bit0 )
: LedOff 1 p1out cbic! ; ok. \ -- Turns Red LED off (clear bit0)
: Flash LedOn 4 us LedOff ; ok. \ -- LED on, wait 4 microseconds, then LED off

: Test 10 0 do Flash loop ; ok \ -- Flash the LED 10 times

Logic Probe capture Port1 bit0 Capture.PNG

IMG_20170602_183404.jpg
 

premelec

Senior Member
@GrahamGo - OT- glad to know FORTH is still in use! Does TI encourage its use or is that your choice?
 

pxgator

Senior Member
The PICAXE system/chips are usually all I need for my projects. When I need something faster I use the MPLAB_X system
with the MCC code generator, XC8, and an 8 bit Curiosity board. It makes C programming for PIC chips about as easy as
it gets. The code generator is awesome. When using this setup I'm still supporting the PICAXE system by using the PICAXE
branded chips...08M2, 14M2, and 20M2. However I have to set the LVP bit to a 1 with a PICKIT3 programmer then the
chips can be used with the 8 bit Curiosity board. The program execution speed difference is huge...but at the end of the
day the PICAXE system is my first choice.

Cheers to All

P.S. The MPLAB_X system is all free and the 8 bit Curiosity board is about $20
 
Last edited:

bpowell

Senior Member
I'm still supporting the PICAXE system by using the PICAXE
branded chips...08M2, 14M2, and 20M2.
So, you're buying PICAXE chips and then flashing over the PICAXE firmware?


P.S. The MPLAB_X system is all free and the 8 bit Curiosity board is about $20
Yes, but full disclosure: You'll need the PICKIT 3, which is ~ $50...unless you're buying raw PICs, in which case, I believe LVP is set by default. Also, although MPLAB-X is free, as well as the XC8 compiler...the "Free" version has no code optimization...this matters if you start to bump into the memory limits...large strings, lots of floating point math, etc. can cause an "out of space" error which doesn't happen with "PRO" optimization enabled. And PRO costs either $30/month (I think) or $1,000-ish...that hurts a bit. (read: a lot!)
 

GrahamGo

Senior Member
@GrahamGo - OT- glad to know FORTH is still in use! Does TI encourage its use or is that your choice?
Hi, Here's my story. I have had the ez430-MSP430 kit for a long time which I received at a TI seminar in L.A. The other day I decided to try their development kit called Code Composer. It took forever to install. I found that the TI folder size using Properties is 2gb. So its quite a program. Then I tried using it, yes it is very comprehensive with lots of features but in the end I decided perhaps it wasn't for me. Anyway, I know Forth and I thought that I would give it a shot. I installed the 8kb kernel and was talking to the target 5 minutes later. Then I did the timing test and posted it here because I thought other souls might be interested. That's basically it.

Today I compiled some C code using the TI C compiler. Here is the code.
Code:
//  Texas Instruments, Inc
//  July 2011
//  Built with Code Composer Studio v5
//***************************************************************************************

#include <msp430.h>				

int main(void) {
	WDTCTL = WDTPW | WDTHOLD;		// Stop watchdog timer
	P1DIR |= 0x01;					// Set P1.0 to output direction
	for(;;) {
		P1OUT ^= 0x01;				// Toggle P1.0 using exclusive-OR
	}	
	return 0;
}
The result? well surprisingly the Forth version is quicker!. One LED cycle taking 8 microseconds. The TI C version taking 10 microseconds. Plus the Forth version has an added 4us delay. Someone may say that the C code can be optimized. But I so can the Forth code :)

Capture2.PNG

Anyway for me this exercise is over. Here is a Forth for a PIC

http://flashforth.com/pic18.html#
 

pxgator

Senior Member
@bpowell

Yes Sir, you are correct the free version of XC8 does not have the optimizations but the code it produces
is many times faster than interpreted basic and the PRO version is free for 60 days. Since I mostly use
the PICAXE system I have a good supply of the PICAXE 'branded' chips. Yes, the raw chips would be cheaper
but I like to support the PICAXE group. I already had a PICkit3 and hopefully someday I'll be able to use it
with PE6 when it is able to compile a program into hex code. Anyway....coming from a C and assembler
background I certainly appreciate what Microchip is offering for free these days. One thing is for sure though,
one can really appreciate what PICAXE does for you in the background when you have to 'roll your own'
libraries in C code.

Cheers to All
 
Last edited:

stan74

Senior Member
I know Tex. I reckon peeps want to do something and there's lot's of c (arduino but not necessarily) examples but no picaxe. I had that problem with glcd's and got help converting screen and buffer stuff to do plot and line and print working in picaxe with hippy's help but dim fun.(bit o welsh there,dim means not). There's no libs for making stuff work. If you buy a 128x64 i2c display then unless you find code like my oled tron which was my attempt at code to show how to get the display working then it's a hard slog. Most stuff on ebay that looks interesting for micro controller users at hobby level is arduino c or rpi sorted out already. The nextion display is interesting as, ok it works for some but there's probs. A similar display for 1/4 the price can run on another pic system much easier than nextion and all the hassle of win designer.. This is a £4 lcd displaying adc10 samples. For you. OK forget graphics. Text in the 3 sizes that's supported gould be picaxe and colours but hey, no init routines availiable so what? roll my own. I did it for ssd1306 and never again...but it was interesting at the time. https://youtu.be/KKYTTMQ1Thg
end o the day..you get on with basic yet want more? like many things a natural progression. to what? Me,I'm sorted and no c. mplab later. the microchip xpress board is tidy, a learning dev board. my nag is the chip is surface mount hence not replaceable,me being careless sometimes. it's usb like arduino...sort of...well a bit.
I should have mentioned that picaxe oled tron I wrote a sub for checking if a pixel was lit...or the game would not be possible. I re-wrote it for other basic and no test pixel routine in any glcd includes for supported displays. After some nagging the developers about my pixel test code not working cos I didn't understand "as alias"variable command..they wrote one,agreeing it would be useful. picaxe servo is another item being implemented using avr compare registers and pic equivalent but not called servo as hard to make universal for al chips.. I just use a 50Hz interrupt and pulseout but uses 16bit timer so compare module better maybe.
 
Last edited:

pxgator

Senior Member
the microchip xpress board is tidy, a learning dev board. my nag is the chip is surface mount hence not replaceable,me being careless sometimes. it's usb like arduino...sort of...well a bit
Hi Stan,

The 8 bit express board is what I use and it has a 20 pin dip socket that
supports an assortment of 8 to 20 pin PIC 8 bit chips. Like I said before, the
MPLAB X system makes programming in C about as easy as it gets. But unless
one has a bit of experience with C it's not nearly as easy as PICAXE basic.
FYI...I'm a 63 year young 'peep'.

Cheers to All

http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM164137

P.S. The mini usb socket is on the bottom of the board.
 
Last edited:

stan74

Senior Member
The 28x2 is was my favourite. Under used. Did the MPU6060 thread get sorted. I sent one to a developer and a rpi touch screen and he wrote a lib for the display and a demo for the MPU6060. You know what I mean?
 

pxgator

Senior Member
Ok , here is a curiosity board that accepts 28/40 pin dips. The 28 pin dip socket is
underneath the 40 pin chip in the picture. None of the curiosity boards require a PICkit 3 programmer.
It's all done with usb. I only use the PICkit 3 to set the LVP bit on my PICAXE chips
so they will work on the curiosity board which uses low voltage programming.

Cheers to All

http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM164136


P.S. I'm not sure about using the MPU6060...also the PICAXE AXE401 board that
supports the 28X2 has an onboard 'plug in' available for a PICkit 3.
 
Last edited:

pxgator

Senior Member
This is the friendliest and most informative forum that I have ever been a member of. I certainly
don't want to break any of the forum rules. After reviewing my last few posts I think I need to make
something clear. For beginning and even experienced folks that want to be productive in the least
amount of time, IMHO the PICAXE system is by far the best solution. The PICAXE tokenized interpreter
that is packed into such a small code space is nothing short of incredible. Some very intelligent
people must write/maintain the PICAXE firmware. For those that have never programmed in C
and/or assembly and wish to do so, be prepared for a culture shock as you will need to wade
deeply into the 'bare metal' aspects of the chip you are using.

Cheers to All
 
Last edited:

stan74

Senior Member
Last September I got into picaxe. I'd done pic asm 15 odd years earlier,made a robot and doing something else too much work.
Made lots of robots with picaxe in no time.Lots of fun. I was impressed.It was basic but for pics. The basic lacked lots of basic basic features like arrays which is not helpful and makes moving data a pain and rather low level.
I like basic and it can be as good as any other programming language as for using it for controlling micro controllers. c for pics is not fun nor is python controlling rpi gpio. The open source basic for 8 bit pic or avr being free and being to see each line of basic and it's asm next is ok.Using pickit 2 or 3 I just click flash hex and if the header is pic it flashes to pic.if the header is mega328 then it flashes to an arduino with or without avrdude bootloader. Pic flashes through standard incircuit programmer from pickit 2 or 3. Pics with tinybootloader can be flashed from a usb to rs232 converter and then you can use the nice terminal. The terminal just works with an arduino uno which is why I started using it instead of pics which was my 1st intention.
It's down to wanting to program a micro-controller and if you want to do it in basic then how. Picaxe,stamp,compilers that cost £100+ or search for alternatives.
If you can do c then would you use picaxe or mplab? Honestly.
I'm using a free real basic compiler for pic and avr and occasionally a free basic compiler for rpi cos python is like c to me.
The pic basic compiler was actually written in the freebasic compiler.Weird.
Picaxe has many happy users,I was happy. The loyalty factor is amazing.
Some people don't see what I'm commenting on,others do. I quite like messing with these pics and try to share my enthusiasm for the subject in wrong ways. It's a picaxe forum I know and forth and stuff is irrelevant but it's nice to chat about people's views and usage of picaxe and how/what they're up to.
I can't help notice threads like this are appearing often. The rev ed answer is the same. So best the moaners move on and let the happy users do their thing.
ps I'm 63...er? I got a free bus pass to. your point? ageism? :)
 
Last edited:

pxgator

Senior Member
If you can do c then would you use picaxe or mplab? Honestly.
Hi Stan,

You made some good points Sir. To answer your questions...I have been programming in C for
many years and I love the language. But if it's doable in PICAXE I will use that instead..why?
Because writing long programs in C is slow and tedious compared to PICAXE basic. I use the
MPLAB X system when I need blazing fast speed, floating point math, large arrays, etc. But if it's
possible PICAXE is my first choice. As for the free bus pass, here in the colonies sometimes
one needs to be 65 years young...:)

P.S. It's nice to see you participating in the forum again

Cheers to All
 
Last edited:

lbenson

Senior Member
If you can do c then would you use picaxe or mplab? Honestly.
Yes. I had written many thousands of lines of C code before I wrote any but the most trivial of Basic programs.

For the types of things Picaxe Basic is good for, I wouldn't consider using C on bare hardware. Fortunately for me, nothing that I have done in the past 23 years of professional and retired hobby work has required C (though I feel fully qualified to pick it up again if the need should arise). Picaxe Basic isn't perfect by any stretch (my first preference would be for better string handling, not more speed), but it does the job for many tasks.
 

rs2845

Senior Member
I had this same question - ended up using bare PIC32 chips with ChipKit for the more powerful tasks. I still use PICAXE to perform the simpler tasks in my projects though.

The investment in a PICKIT3 is worth it if you *really* need the power - but I just got a £10 clone on Amazon and it works the same. Cheaper than an FTDI lead.

Be prepared though - you either replicate one of the Chipkit boards or make your own (like I did with the QFP100 PIC32's which I soldered via paste and hot air). It was *extremely* frustrating and there was lots of waste, but I now have the tools to build everything I want.

What I will say is - the Microchip docs and Chipkit wiki are both convoluted at times and I do miss the simpler 1/2/3 manuals on here!
 

pxgator

Senior Member
Here is a SIMPLE comparison that illustrates why one would likely choose PICAXE basic over C.
Both programs do the same thing and that is to measure a pulsewidth with a nominal value
of 800 milliseconds (WWVB marker bit) with some room for a shorter or longer pulse. The
only difference being the PICAXE code uses a timer tick of 20us and the C code uses 16us. But
the PICAXE code is only a few lines and it only uses 57 out of 2048 codewords where the C
code has many more lines and uses 408 out of 4096 codewords. The C code was compiled
with the 'free for 60 days' PRO version of XC8 using MPLAB X of course. Naturally the compiled
C code will run many times faster but the speed in this and many cases is simply not needed...:)

PICAXE:

Code:
[color=Navy]#picaxe [/color][color=Black]08m2[/color]
[color=Navy]#Terminal 2400
#no_data[/color]


[color=Blue]setfreq m2    [/color][color=Green];pulsin ticks will now equal 20us[/color]

[color=Blue]symbol LED [/color][color=DarkCyan]= [/color][color=Blue]C.2
symbol aPulse [/color][color=DarkCyan]= [/color][color=Blue]C.4
symbol [/color][color=Purple]pwidth [/color][color=DarkCyan]= [/color][color=Purple]W0[/color]


[color=Blue]do
  pulsin aPulse[/color][color=Black], [/color][color=Navy]1[/color][color=Black], [/color][color=Purple]pwidth
  [/color][color=Blue]sertxd([/color][color=Red]"Pulsewidth = "[/color][color=Black], #[/color][color=Purple]pwidth[/color][color=Black], [/color][color=Blue]CR[/color][color=Black], [/color][color=Blue]LF)

  if [/color][color=Purple]pwidth [/color][color=DarkCyan]> [/color][color=Navy]35000 [/color][color=DarkCyan]AND [/color][color=Purple]pwidth [/color][color=DarkCyan]< [/color][color=Navy]45000 [/color][color=Blue]then
    high LED
    pause [/color][color=Navy]75
    [/color][color=Blue]low LED
  endif
loop[/color]
MPLAB:

Code:
[color=DarkCyan]//[/color][color=Black]PIC12F1840 [/color][color=Blue]([/color][color=Black]PICAXE 08M2[/color][color=Blue]) [/color][color=Black]configuration [/color][color=Blue]for [/color][color=Black]oscillator, timer1, [/color][color=Purple]pins[/color][color=Black], etc. [/color][color=Blue]all[/color]
[color=DarkCyan]//[/color][color=Black]done with MPLAB Code Configurator [/color][color=Blue]([/color][color=Black]MCC[/color][color=Blue])[/color]


[color=Navy]#define [/color][color=Black]C_5 RA5       [/color][color=DarkCyan]//[/color][color=Black]pin [/color][color=Blue]C.5 [/color][color=Black]leg [/color][color=Navy]2 [/color][color=Blue]output to [/color][color=Black]LED[/color]

[color=Navy]#define [/color][color=Black]pinC_4 RA4    [/color][color=DarkCyan]//[/color][color=Black]pin [/color][color=Blue]C.4 [/color][color=Black]leg [/color][color=Navy]3 [/color][color=Blue]input for [/color][color=Black]pulse signal[/color]

[color=Navy]#include [/color][color=Red]"mcc_generated_files/mcc.h" [/color]


[color=Black]uint16_t [/color][color=Blue]pulsin([/color][color=Black]void[/color][color=Blue])[/color][color=Green];    //function prototype declarations[/color]
[color=Black]void timer1_reset[/color][color=Blue]([/color][color=Black]void[/color][color=Blue])[/color][color=Green];  //    "        "         "[/color]

[color=Black]uint16_t pwidth[/color][color=Green];          //symbol pwidth = unsigned integer (16 bits))[/color]



[color=Black]void main[/color][color=Blue]([/color][color=Black]void[/color][color=Blue]) [/color][color=DarkCyan]//[/color][color=Black]MAIN [/color][color=Blue]LOOP[/color]
[color=Gray]{
  [/color][color=DarkCyan]//[/color][color=Black]using PIC12F1840 [/color][color=Blue]([/color][color=Black]PICAXE 08M2[/color][color=DarkCyan]+[/color][color=Blue]) [/color][color=Black]@ 2mhz
  
  SYSTEM_Initialize[/color][color=Blue]()[/color][color=Green]; //apply MCC configuration
  
  [/color][color=DarkCyan]//[/color][color=Black]ENDLESS INNER [/color][color=Blue]LOOP
  do
  [/color][color=Gray]{  
    [/color][color=Black]pwidth [/color][color=DarkCyan]= [/color][color=Blue]pulsin()[/color][color=Green];                    //call routine to measure pulse width
    [/color][color=Black]printf[/color][color=Blue]([/color][color=Red]"Pulsewidth = %u\r"[/color][color=Black], pwidth[/color][color=Blue])[/color][color=Green];  //serial out to pin C.0 (leg 7)
                                          [/color][color=DarkCyan]//[/color][color=Black]@ [/color][color=Navy]9600 [/color][color=Black]baud configured with MCC
     
    [/color][color=Blue]if([/color][color=Black]pwidth [/color][color=DarkCyan]> [/color][color=Navy]43750 [/color][color=DarkCyan]&& [/color][color=Black]pwidth [/color][color=DarkCyan]< [/color][color=Navy]56250[/color][color=Blue])  [/color][color=DarkCyan]//[/color][color=Black]test [/color][color=Blue]for [/color][color=Black]pulse width of [/color][color=Navy]701
    [/color][color=Gray]{                                     [/color][color=DarkCyan]//[/color][color=Blue]to [/color][color=Navy]899 [/color][color=Black]milliseconds
      C_5 [/color][color=DarkCyan]= [/color][color=Navy]1[/color][color=Green];          //HIGH LED
      [/color][color=Black]__delay_ms[/color][color=Blue]([/color][color=Navy]150[/color][color=Blue])[/color][color=Green];  //pause 150 milliseconds (XC8 library function))
      [/color][color=Black]C_5 [/color][color=DarkCyan]= [/color][color=Navy]0[/color][color=Green];          //LOW LED
    [/color][color=Gray]}
    
  [/color][color=Navy]}[/color][color=Blue]while ([/color][color=Navy]1[/color][color=Blue])[/color][color=Green];[/color]
[color=Navy]}[/color]

[color=DarkCyan]//============================================================================//

//[/color][color=Black]TIMER1 [/color][color=DarkCyan]set [/color][color=Blue]for [/color][color=Purple]timer [/color][color=Black]enabled, synchronization enabled, FOSC[/color][color=DarkCyan]/[/color][color=Navy]4[/color][color=Black],[/color]
[color=DarkCyan]//and [/color][color=Black]prescaler of [/color][color=Navy]1[/color][color=Black]:[/color][color=Navy]8 [/color][color=Black]so that [/color][color=Purple]timer [/color][color=Black]increments at 16us ticks. The[/color]
[color=DarkCyan]//[/color][color=Black]Timer1 functions are generated with the MCC

uint16_t [/color][color=Blue]pulsin()                   [/color][color=DarkCyan]//[/color][color=Black]function returns a [/color][color=Navy]16 [/color][color=DarkCyan]bit [/color][color=Black]unsigned integer[/color]
[color=Gray]{
  [/color][color=Black]timer1_reset[/color][color=Blue]()[/color][color=Green];                   //reset timer 1
  [/color][color=Blue]do                                [/color][color=DarkCyan]//[/color][color=Blue]wait if high
  [/color][color=Gray]{
    [/color][color=Blue]if([/color][color=Black]TMR1_ReadTimer[/color][color=Blue]() [/color][color=DarkCyan]>= [/color][color=Navy]62500[/color][color=Blue])   [/color][color=DarkCyan]//[/color][color=Black]one second timeout
      [/color][color=Blue]return [/color][color=Navy]0[/color][color=Green];
  [/color][color=Navy]}[/color][color=Blue]while([/color][color=Black]pinC_4 [/color][color=DarkCyan]== [/color][color=Navy]1[/color][color=Blue])[/color][color=Green];
  
  [/color][color=Black]timer1_reset[/color][color=Blue]()[/color][color=Green];
  [/color][color=Blue]do                                [/color][color=DarkCyan]//[/color][color=Blue]wait if low
  [/color][color=Gray]{
    [/color][color=Blue]if([/color][color=Black]TMR1_ReadTimer[/color][color=Blue]() [/color][color=DarkCyan]>= [/color][color=Navy]62500[/color][color=Blue])   [/color][color=DarkCyan]//[/color][color=Black]one second timeout
      [/color][color=Blue]return [/color][color=Navy]0[/color][color=Green];
  [/color][color=Navy]}[/color][color=Blue]while([/color][color=Black]pinC_4 [/color][color=DarkCyan]== [/color][color=Navy]0[/color][color=Blue])[/color][color=Green];
  
  [/color][color=Black]timer1_reset[/color][color=Blue]()[/color][color=Green];                   //low to high transition
  [/color][color=Blue]do                                [/color][color=DarkCyan]//[/color][color=Black]measuring pulse now
  [/color][color=Gray]{
    [/color][color=Blue]if([/color][color=Black]TMR1_ReadTimer[/color][color=Blue]() [/color][color=DarkCyan]>= [/color][color=Navy]62500[/color][color=Blue])   [/color][color=DarkCyan]//[/color][color=Black]one second timeout
      [/color][color=Blue]return [/color][color=Navy]0[/color][color=Green];
  [/color][color=Navy]}[/color][color=Blue]while([/color][color=Black]pinC_4 [/color][color=DarkCyan]== [/color][color=Navy]1[/color][color=Blue])[/color][color=Green];
   
  [/color][color=Blue]return [/color][color=Black]TMR1_ReadTimer[/color][color=Blue]()[/color][color=Green];         //return 16 bit pulse width[/color]
[color=Navy]}[/color]

[color=DarkCyan]//============================================================================//

//[/color][color=Black]Function [/color][color=Blue]to stop [/color][color=Black]the [/color][color=Navy]16 [/color][color=DarkCyan]bit [/color][color=Black]timer1, [/color][color=Blue]reset [/color][color=Black]the [/color][color=Blue]count to [/color][color=Black]zero, [/color][color=DarkCyan]and [/color][color=Blue]restart [/color][color=Black]it.

void timer1_reset[/color][color=Blue]([/color][color=Black]void[/color][color=Blue])[/color]
[color=Gray]{
  [/color][color=Black]TMR1_StopTimer[/color][color=Blue]()[/color][color=Green];
  [/color][color=Black]TMR1_WriteTimer[/color][color=Blue]([/color][color=Navy]0[/color][color=Blue])[/color][color=Green];
  [/color][color=Black]TMR1_StartTimer[/color][color=Blue]()[/color][color=Green];[/color]
[color=Gray]}[/color]

[color=DarkCyan]//============================================================================//[/color]
 
Last edited:

stan74

Senior Member
I'm surprised this thread has gone on so long. I must have spent £lots of at rev ed 's shop. Not moaning. More fun than spent on beer :) It's fun not "serious"..yes?
Arduino c compiler is bloated but does lots of repeated calculations pretty quick but it's down to the math stuff. mplab c is probably better for pic.
I don't get the above "Both programs do the same thing and that is to measure a pulsewidth with a nominal value
of 800 milliseconds" That is pulsein us in gcb.
This is code I used for reading adc10 and displaying on 320x240 lcd. The lcd type is named and the generic include glcd.h compiles the code for that device. The init at the start for lcd pins is easy. The main prog is about arrays and data. very repetitive. This is like msbasic dos. hippy could convert it to picaxe,I could but messing with memory on picaxe is a bit low level...@ptr was one thing but @bptr l8r. note basic looks basicy. This is academic. No 32 bit picaxe I reckon and hippy can't solve everything. Actually c isn't that hard. I spent so long converting c to basic I'm getting the hang of it. Can't say that for python and linux commands.It's all magic. Anyroad, this is understandable...not really and wouldn't be easier in picaxe but if it was in c it would more complicated??? that's what gets me..people learn c why? the stigma of interpreted basic,goto's rubbish et al? or maybe micro chip don't really do a "free" basic compiler.
If your one of the few that picaxe isn't good enough or arduino user that isn't happy with c or rpi python user that thinks python on rpi slow or bloody difficult there are free solutions and just letting you know. The best thing about picaxe is the forum when you first get started. Everyone starts somewhere and it seems strange at first. Go to Nextion site...carp
Code:
;display repetitive wave forms on ILI9341 display with vectors
#chip mega328p,16
#option explicit
#include <glcd.h>
;
    #define GLCD_TYPE GLCD_TYPE_ILI9341

    'Pin mappings for SPI - this GLCD driver supports Hardware SPI and Software SPI
    #define GLCD_DC   portd.2 ;    DIGITAL_2         ' Data command line DC
    #define GLCD_CS   portd.7 ;    DIGITAL_7          ' Chip select line CS
    #define GLCD_RESET   portd.4 ;      DIGITAL_4         ' Reset line Tie high..not needed but don't erase
    #define GLCD_DO   portb.0 ;   DIGITAL_8          ' Data out | MOSI SDI
    #define GLCD_SCK   portb.4 ;   DIGITAL_11          ' Clock Line SCK

;    #define ILI9341_HardwareSPI    ' remove/comment out if you want to use software SPI.


    'GLCD selected extension font set. ASCII characters 31-254, the extended font uses 1358 bytes of program memory
    #define GLCD_EXTENDEDFONTSET1
    GLCDfntDefaultsize = 1

    'GLCDCLS  supports GLCDBackground as default
    'GLCDCLS  also support passing color parameter.
    'GLCDCLS [color]

;
dir portc.0 in
dim volt as word
dim volt2 as word
dim ptr1 as word
dim ptr2 as word
dim buffer1 (80)
dim buffer2 (80)
dim xpos_new as word
dim ypos_new as byte
dim xpos_old as word
dim ypos_old as byte
dim xpos1_new as word
dim ypos1_new as byte
dim xpos1_old as word
dim ypos1_old as byte
;
GLCDRotate ( Portrait_Rev )
GLCDfntDefaultsize = 3
GLCDCLS ILI9341_BLUE
filledbox  0,0,239,257,ILI9341_BLACK
box  0,0,239,257,ILI9341_YELLOW
;
for ptr1=1 to 80 ;read 80 samples
  volt = READAD10 (an0)
  buffer1 (ptr1)=255-(volt/4) ;fit 1024 to screen 0,0
  buffer2 (ptr1)=buffer1 (ptr1)
next ptr1
;
do ; start of main loop
  ptr1=1
  ptr2=1
  do until ptr1=59 ;erase old screen data and redraw new
    ypos_old=buffer2 (ptr1) ;old data
    ypos_new=buffer2 (ptr1+1)
    xpos_new=ptr2+4
;
    ypos1_old=buffer1 (ptr1) ;new data
    ypos1_new=buffer1 (ptr1+1)
    xpos1_new=ptr2+4
;
    line ptr2,ypos_old+1,xpos_new,ypos_new+1,ILI9341_BLACK ;erase last data
    line ptr2,ypos1_old+1,xpos1_new,ypos1_new+1,ILI9341_cyan ;draw new data
;
    ptr1=ptr1+1 ;data pointer
    ptr2=ptr2+4 ;x position for start and end line x positions
  loop
;ploting done now redraw cursor
line 1,127,239,127,ILI9341_GREEN ; Draw cursor
line 119,1,119,254,ILI9341_GREEN ;after ploting
;
do
  volt = READAD10 (an0)
  volt2 = READAD10 (an0)
loop until (volt>510)  and (volt2>volt)
;
for ptr1=1 to 79 ;get new samples
  volt = READAD10 (an0)
  repeat 2 ;scale 1024 bit sample to 255 pixels ie divide by 4
    set c off
    rotate volt right
  End Repeat
  buffer2 (ptr1)=buffer1 (ptr1) ;new data to old data
  buffer1 (ptr1)=255-volt ;set 0,0 top left screen and update new data
next ptr1
;
loop ;end of main
 
Last edited:

GrahamGo

Senior Member
Hi, I was a bit nervous when I started this thread. Because after all, it is specifically a Picaxe forum. But I find that with the Pixace it is so easy to use and so well documented that with a bit of perseverance there is seldom need to ask questions about the Picaxe hardware or firmware. This is a complement to the Picaxe developers!

I am a little curious as to the demography of the users outwith the school/educational group. I suspect that there are a lot of 60+'ers which must bring a wide experience,and expertise to the forum. I myself, so far, have only had two private chats on this Forum, but it was obvious that they were both well educated and experienced folks. I mirror what @pxgator (a relative child with 67 posts, against my massive 99 posts) has said about this forum being a friendly forum. It definitely is, love it.
Oh, I have a free bus pass too. :)
 

fernando_g

Senior Member
Hi, I was a bit nervous when I started this thread. Because after all, it is specifically a Picaxe forum. But I find that with the Pixace it is so easy to use and so well documented that with a bit of perseverance there is seldom need to ask questions about the Picaxe hardware or firmware. This is a complement to the Picaxe developers!

I am a little curious as to the demography of the users outwith the school/educational group. I suspect that there are a lot of 60+'ers which must bring a wide experience,and expertise to the forum. I myself, so far, have only had two private chats on this Forum, but it was obvious that they were both well educated and experienced folks. I mirror what @pxgator (a relative child with 67 posts, against my massive 99 posts) has said about this forum being a friendly forum. It definitely is, love it.
Oh, I have a free bus pass too. :)
Another 0x3D years old user here.
I completely agree that this is one of the friendliest forums on the Web. I've been a forum user since 2008, and I don't remember a flame war ever. Nor a banning for that matter.

It is also extremely helpful, there are so many very knowledgeable contributors here.
 

stan74

Senior Member
Hi, I was a bit nervous when I started this thread. Because after all, it is specifically a Picaxe forum. But I find that with the Pixace it is so easy to use and so well documented that with a bit of perseverance there is seldom need to ask questions about the Picaxe hardware or firmware. This is a complement to the Picaxe developers!

I am a little curious as to the demography of the users outwith the school/educational group. I suspect that there are a lot of 60+'ers which must bring a wide experience,and expertise to the forum. I myself, so far, have only had two private chats on this Forum, but it was obvious that they were both well educated and experienced folks. I mirror what @pxgator (a relative child with 67 posts, against my massive 99 posts) has said about this forum being a friendly forum. It definitely is, love it.
Oh, I have a free bus pass too. :)
Picaxe goes back several years and the same question has been asked and similar ones for years. Picaxe was designed to do a job and it does that well. It's mature and bug free. I don't think it was made to push to it's limits and people who sweat doing something that needs repeated calculations and lots of memory arrays as in writing the Game Of Life say and displaying it then that seem pointless although it's been tried it seems. I tend to fall back on what I've learnt and c and python weren't around in the 80's much (c was available) but puters came with basic then.
I'd recommend picaxe to someone getting started with no experience of pics. Getting up and running with something new is important to me or I get fed up and think it's not fun but picaxe (apart from my silly syntax errors) was quick to learn and the basic to pic extended keywords apply to other coding methods. I have to agree picaxe does most thing you'd want to do although as your skills develop there comes a time some might seek an alternative...don't get a rpi unless you can use linux and python or brain ache :) It's not windows!
 

stan74

Senior Member
Hi Stan,

The 8 bit express board is what I use and it has a 20 pin dip socket that
supports an assortment of 8 to 20 pin PIC 8 bit chips. Like I said before, the
MPLAB X system makes programming in C about as easy as it gets. But unless
one has a bit of experience with C it's not nearly as easy as PICAXE basic.
FYI...I'm a 63 year young 'peep'.

Cheers to All

http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM164137

P.S. The mini usb socket is on the bottom of the board.
you mean one of these? http://uk.rs-online.com/web/p/processor-microcontroller-development-kits/1229825/ no socket for other pic?
I bin nagged to get one for a common dev level but undecided. Not price issue and safe got usb but without tiny bootloader then no terminal. (easy solved)
I only ever used microchip mpasm years ago not the lab stuff and never used c. The vid and the code that runs I posted is basic and compiled basic running on uno mega328p.
That was my point about 32picaxe and why and if not then alternatives. Thinking about age,other developers are getting older. What's the new generation doing?
 

pxgator

Senior Member
@premelec

I cleaned up the Obfuscated C Code a bit so take a look....is it what one
might expect Sir ?? I'm not sure how it could be any easier to understand..:)

Cheers to All
 

stan74

Senior Member
SAM_1593.JPG
Obfuscated as posting images sometimes but 1 meg is kodak brownie. It's supposed to be vero with 28pin socket. The chips with more than 1k ram tend to be 28pin...like 28x2
 

stan74

Senior Member
SAM_1597.JPG
spot the picaxe. The 28 pin dip socket is underneath the
(40 pin chip) table in the image. :)
interesting link but don't need on board debugger et al. I'm not bothered interfacing to microchip apart from using data sheets and chips...and fake pickit 2/3. don't need with bootloader. I should try. I program arduino at chip level via avrdude bootloader and that gives serial back to pc via usb. Tiny bootloader for pic the same and ttl/usb I got but not tried. Works as is.Why break it? bootloader saves writing serial.
Thinking,starting off? get a 28x2 picaxe dev board. should work straight away or mess around with 8pin?
 
Last edited:

pxgator

Senior Member
Thinking,starting off? get a 28x2 picaxe dev board. should work straight away or mess around with 8pin?
Squeezing as much as possible out of the PICAXE 08M2 (PIC12F1840) is great fun.
Especially at 32mhz where it will execute 8000 single cycle PIC style instructions
per millisecond. With C code it is very easy to set up a 1 millisecond interrupt to emulate
the Arduino style millis() function. The chip automagically does most of the housekeeping
for you with interrupts.

Cheers to All

P.S. Time for this old geezer to go down a couple beers...Good luck Stan
 
Last edited:

stan74

Senior Member
I got a 12c? 8 pin pic on vero and a tv ir sensor and 2 ir led... a primitive range finder, I hated them pics...1 time programming error. Someone mentioned xpress board and this guy is pushing out his own boat for a non spielberg vid but what works. not the best way to push an idea I thought but then he don't get paid for it...it's open source like arduino.... so what's the initiative to develop it? No free lunch theory. Darn I'm cynical. https://www.youtube.com/watch?v=OLUO9R97s6o&t=442s
pic is easier with pickit, arduino just plug in usb, arduino actual chip no bootloader-use as pic
next best to waiting for 32picaxe. it's basic jim but not as we know it
 
Last edited:
Top