A beginners first play with the 18M2

donrecardo

Senior Member
Being a beginner my experiments are nothing special but thought it might encourage other newbies to get their feet wet and have a go
BTW. I use the AXE091 Developement board as my test bed , its a god send as its already got everything on it like LEDS with series resistors , switches etc.

First thing I wanted to try was the new touch command .

A have a bunch of those ready made wires with pins on each end that you use with breadboards so I soldered one to a bit of PCB about an inch square
and plugged it into C.2 ( pin 1)
I did
Code:
Main:
Touch c.2 , B0
debug
pause 500
goto main
When I ran it B0 had a value around 160 to 175
when I touched the back of the PCB the value went between 250 to 255
so far so good
So I then hooked up an LED to B.4 ( pin 10 ) and changed the code to

Code:
       Main:
             Touch c.2 , B0
             if B0 > 200 then
                   High B.4
             Else
                    Low B.4
             endif
       goto main

Great, it worked , :) when I touch the back of the PCB it lights the led , and it goes out when I let it go

Encouraged by this I wanted more , 2 touch contacts no less.
Being a lazy and impatient bugger I forgot to solder a bit of PCB to the second wire and used just the bit of insulated wire with a pin on each end

I put this one in B.3 ( pin 9) and the second LED into B.7 ( pin 13)

I altered the code
Code:
   Main:
             Touch c.2 , B0
             if B0 > 200 then
                   High B.4
             Else
                    Low B.4
             endif

            Touch B.3 , B1
             if B1 > 200 then
                   High B.7
             Else
                    Low B.7
             endif

       goto main
It was when I ran it and went to touch the second pcb touch pad I realized
that I had forgotten to solder a bit of PCB on , but what the heck, lets go for it . I touched the insulated wire and it worked just as well as the other one with PCB on it :confused:

I disconected the AXE027 usb programming lead so I could run it stand alone
( I wanted to take it downstairs to show the wife how her husband was close to taking over the world with his new found electronic skills), but thats when it all went wrong
After unplugging the USB lead one of the inputs stopped responding , strangely it was the one with the PCB touch pad , the plain wire still worked great. I relaced this touch pad with another plain wire and once again it all worked . I am not sure why this happens , my guess is my touch pad is too large and after unplugging the USB lead some how the capacitance is changing and knocking my calibration out of range , Maybe it will work better with Touch16 , I havent tried that yet.
Anyway, onwards and upwards, there is no stopping me now.

Multitasking :eek:

Making a second task is easy , Lets flash an LED
so LED to B.6 ( pin 12)
and run the code
Code:
main2:
high b.6
pause 200
low b.6
pause 200
goto main2
The LED flashes as it should , but now how to make that program run at the same time as the earlier code . Wow thats easy , just add a start1: and start2: like this
Code:
Start1:
   Main:
             Touch c.2 , B0
             if B0 > 200 then
                   High B.4
             Else
                    Low B.4
             endif

            Touch B.3 , B1
             if B1 > 200 then
                   High B.7
             Else
                    Low B.7
             endif
       goto main

Start2:
    main2:
              high b.6
              pause 200
              low b.6
              pause 200
   goto main2
Woot and Yay it works :D
The 3rd Led blinks away and the other two light every time I touch the two wires.

Its real easy, have a go

Don
 

Technical

Technical Support
Staff member
Code:
Start0:   ; <-------------------------------
Start1:
   Main:
             Touch c.2 , B0
             if B0 > 200 then
                   High B.4
             Else
                    Low B.4
             endif
 
            Touch B.3 , B1
             if B1 > 200 then
                   High B.7
             Else
                    Low B.7
             endif
       goto main
 
Start2:
    main2:
              high b.6
              pause 200
              low b.6
              pause 200
   goto main2
Glad you like it! We have added an extra optional 'start0:' label in your example to actually show you that you have 3 tasks running, not 2. Have a think about what is going on!
 
Just in case anyone is still reading this AXE091 blog, may I ask some questions?
I just took delivery of a second hand Development Board AXE091 that I bought off German ebay, it looks to have hardly been used.....like never.....paid less than half what they would cost new here.....PICAXE Stuff is expensive compared to the UK here....
I see that there are red patches of plastic on the bottom of the board, probably to protect these areas when wave soldering, do they need to be removed? I cannot find them mentioned anywhere, so I have basically no idea......(nothing new!!)
I do believe (vague memory!) on some other boards from PICAXE, they recommended removal.
Is there a full schematic of this PCB anywhere that I can download, some of the bits on the PCB like the large contact areas (under the red plastic stuff), under the board, I see no reference to in the documentation that I have found.
Any information further to the small pamphlet about this PCB will be gratefully received....
Regards
Andy
 
Top