Please point me to some step by step basics to code the PICAXE using Blockly.

Technical

Technical Support
Staff member
Are you wiring directly to the picaxe output pin (not using a darlington buffered output such as on an AXE020 project board - on the AXE020 the direct connection is the pcb pads between the two chips?)
 

Gramps

Senior Member
In the simulator this code lights two LEDs one from pin 6 to ground and the other from pin one to ground. I want to light 1 LED placed between pin 6 and pin 1.
No we did not wire directly to the chip.
 

Technical

Technical Support
Staff member
The code will do this, but you need to have the electronics correct too. Electrically a darlington driver buffered output cannot do this, which is why you need to connect direct.
 

lbenson

Senior Member
this code will not light an LED across pins b1 and b6. Why?
Trust you have a resistor in series with the LED--at least 330R for 5V supply. Otherwise you could have burned out a pin with excess current. How about B.1 to B.7 and B.2 to B.6?
 

Gramps

Senior Member
Opps! forgot the resistor. Touched the led to the pins for a few moments to see if it was really working. It was!
 
Last edited:

Gramps

Senior Member
A new thought and a question;
Could the pin pairs (for example, B1 and b6 ) that control the matrix be reversed to light one of the LEDs from the 19 diode string? If so that would save 4 pins....;)
 

lbenson

Senior Member
I haven't considered it in detail, so may well be wrong, but at first glance, your idea sounds good, and you could, in fact, pair each of the 16 diodes in the 4x4 matrix with another one with (effectively) cathode soldered to anode and anode to cathode. This would give you 32 LEDs controlled by 8 pins. All of a sudden the 28X2 has a lot of spare pins.
 

Gramps

Senior Member
Here is the code.

main:
do
high b.1
low b.6
pause 1000
low b.1
high b.6
pause 1000
loop
Connected two LEDs anodes to cathodes (with resisters this time:)) back to back. One flashes, one does not....why? both should flash. Correct?
 

lbenson

Senior Member
Works for me. Only one resistor is needed, but if one LED is working, a second resistor shouldn't make a difference. (Though it is possible to wire it so that the current flowing in one direction goes through one resistor, but in the other through two, so too much resistance in one direction is possible (though not likely unless you have very high-value resistors)--what is your layout?)
 
Last edited:

AllyCat

Senior Member
Hi,

.... you could, in fact, pair each of the 16 diodes in the 4x4 matrix with another one with (effectively) cathode soldered to anode and anode to cathode. This would give you 32 LEDs controlled by 8 pins. All of a sudden the 28X2 has a lot of spare pins.
I believe that will only work if you "tristate" (change to a high impedance input) the "unrequired" row and/or column drive pins in the matrix. My back-of-envelope (literally) calculation with a 2 x 2 matrix (and 8 LEDs) lights two LEDs if one row and one column are driven High and the other pair Low.

Then, you're well on the way to reinventing the Charlieplex, where you could save even more pins (42 LEDs on 7 pins). ;)

Cheers, Alan.
 

lbenson

Senior Member
I believe that will only work if you "tristate" (change to a high impedance input) the "unrequired" row and/or column drive pins in the matrix.
Right. That was the plan as implemented in the code in post 44 with "dirsB = %00000000 ' set all portB pins inputs" before setting the appropriate pin pair high and low.
 

Gramps

Senior Member
I have not tried it yet but would think that making pins B1 and B6 low (or high) would turn both LEDs off.

Yup, works as expected!

#picaxe 28x1
#no_table
#no_data

main:
do
high b.1
low b.6
pause 1000
low b.1
low b.6
pause 1000
high b.6
low b.1
pause 1000
high b.6
high b.1
pause 1000

loop
 
Last edited:

lbenson

Senior Member
I don't understand tri-state. Is that different from the three possible conditions in my code?
"Tri-state" is a"high impedance" state in which a pin will neither source nor sink (significant) current. This is the state which a picaxe pin is in when it is an input, and it is the state in which non-active pins in a matrix or charlie-plexing configuration should be.

In the program in post 44, for each note played, all of the port B pins are first tri-stated with the command, "dirsB = %00000000" (which makes them all inputs and turns off the previously-lit LED) before the 2 pins which are to be activated to turn on a single LED in the 16-LED matrix are made HIGH and LOW respectively. Tri-stating them effectively disconnects them from the circuit so that they do not influence which LED is lit.
 

hippy

Technical Support
Staff member
A pin can also be tri-stated using the "INPUT <port>.<pin>" command. It does what "dirs<port>=" does but only affects a single pin on the port.

Basically a pin can be in one of three states; Input, Output High or Output Low. For two pins there will be nine possible combinations of the two in total.

When used for LED control, multiplexing or charlieplexing, an input state can be thought of as the setting where no current will flow in or out of that pin. Not enough to illuminate any LED anyway.

So generally all pins should be set as Input to turn all LED's off. The pin which controls a LED's anode should be set High, the pin which controls the cathode should be set Low, to turn a particular LED on.
 

Gramps

Senior Member
We're assembling the AXE133Y Serial OLED.
Mounting the PCB on the front of the OLED rather on the back seems possible. Is that personal preference?
 

hippy

Technical Support
Staff member
It is not clear how you mean by "mounting on the front". The connections between the main board and the display are all in a particular order which must be maintained or the assembly won't work, may damage the main board and/or display.
 

Gramps

Senior Member
When the board is sodered under the OLED it is tucked away. If it is placed on top (same pin configuration) it's more accessible to use the extra pins if one wanted to....
Also is it necessary to connect the OLED to B7? We had other plans for that pin:cool:
 

hippy

Technical Support
Staff member
In my mind I had imagined going from the first to the second, but the third option is feasible as it's a single row connector -

Code:
    _                           _                  _
 __| |                       __| |              __| |
|  | |   _             _    |  | |             |  | |
|  | |  | |-.         | |-. |  | |             |  | |
|  | |  | | |         | | | |  | |             |  | |
|__| |  | |-'         | |-' |__| |             |__| |
   | |  | |O          | |O     | |            _   | |
   | |==|_|           |_|======| |           | |==| |
   |_|                         |_|          O| |  |_|
                                           .-| |
 OLED  AXE132                              | | |
                                           `-|_|
The main issue might be in mounting the OLED in a box or on a panel if you wanted to do that. The assembly won't look as neat as when the AXE132 board is tucked behind the OLED but it should work.

As lbenson notes, any general purpose digital output pin can be used to drive the AXE132 using SEROUT.
 

Gramps

Senior Member
Thank you to both of you for your help! We now have all the hardware we ordered including 40 * 2 chip. The biggest difficulty now is syntax errors.
The editor tells us we have one but not how to correct it.
Learning the picaxe language, but don't know how to spell the words or where they go in the sentence!
Even code copied off the internet will read syntext errors sometimes. Sigh......
 

hippy

Technical Support
Staff member
The biggest difficulty now is syntax errors. The editor tells us we have one but not how to correct it.
In many cases there will be something additional to the "Syntax Error" itself which gives a hint as to what is wrong. When there isn't the arrow pointing to where the error is detected in a line can also provide an indicator as to what caused the error to be produced.

The more you use and get familiar with PICAXE basic the easier it is to spot what you have done wrong. If you are struggling, post the error message and relevant code and members here will be able to advise on the issue.
 

lbenson

Senior Member
... The biggest difficulty now is syntax errors.
The editor tells us we have one but not how to correct it.
What error? With PE6, I have found that with some "program too long" errors, the syntax checker doesn't tell you that, and doesn't tell you where the problem is first detected--especially noted using too-long eeprom statements.
 

Gramps

Senior Member
Forgive me for jumping around from subject to subject.
The OLED does not respond.
Here's The code loaded correctly into the 28x1 on the 28 pin project board.
init: pause 500
main: serout B.7,N2400,(254,128)
SEROUT B.7,N2400,("Hello:123")
end
We removed the jumper on the project board to plug in positive and negative of the OLED.

Edit: (Oops! That pin is power IN not power out!)

We plugged the output pin from the OLED directly into pin 28 on the project board.(That's b.7, correct?)
OLED does not light.

Edit: Found the problem! Power must be applied to the OLED to operate!
 
Last edited:

Gramps

Senior Member
Let me know if I'm off thread. Trying to get the Editor running on my office comp. It's a Windows 10 machine. The download comes in fine but it will not launch the Editor.
 

Circuit

Senior Member
Let me know if I'm off thread. Trying to get the Editor running on my office comp. It's a Windows 10 machine. The download comes in fine but it will not launch the Editor.
Is this your machine or does the "office" own and operate it? Windows 10 can be set to prevent the installation of unauthorised software. Are you logged in as an 'administrator' or a 'user'. You may need administrator rights to install the software.
 

Gramps

Senior Member
Our office recently networked if that would make any difference. Tried logging on as administrator but that didn't help either. I don't think there's any problem with adding software but our tech guy is out of town this week so I'll probably have to wait till he gets back.
 

hippy

Technical Support
Staff member
The download comes in fine but it will not launch the Editor.
It would help if you could clarify exactly what that means, what does happen, what error messages you get, what exactly happens when you do try to launch it, how you are trying to launch it.

Is the problem with installing the download or, did that complete, and you cannot launch the application from the desktop icon ?
 

Gramps

Senior Member
Edit; you cannot launch the application from the desktop icon ? Correct.

Ok. Will look at the Editor tomorrow as it tries to boot and see if i can spot the error.

Question. Have a 40x2 chip mounted on the bread board and have an AXE029 Breadboard adapter to plug into serial in and serial out.. It plugs into pins 6(serin) and 7 (serout), correct?
Edit; TXD is transmit data, goes to 6 serin, correct?
Edit; That means the ground pin on the adapter connects to pin 8, correct?
Then we need 5 volts positive to pin 11 and ground to pin 12, correct?
Pin 1 gets the 10k and the reset switch which goes to ground, correct? Is that the reset pull up resister?
What is the external resonator?
 
Last edited:

lbenson

Senior Member
Per manual 1, page 11, legs 11 and 32 are 5V, legs 12 and 31 0V (because of the ambiguity involving "pin", folks here generally use "leg" to refer a physical pin and "pin" for a logical pin (e.g., pin C.1)).

The reset leg must be pulled up.

On the 40X2, the external resonator is needed for the highest speeds, but is otherwise optional. See manual 1, page 42 (in my version) for details of the 40X2 circuit.
 

lbenson

Senior Member
Not sure what you're asking. Legs 12 and 31 are 0V on the 40X2, and 0V of anything connected to the breadboard (e.g., power supply, programming adapter, sensors, leds) must all be connected together.
 

hippy

Technical Support
Staff member
Edit; TXD is transmit data, goes to 6 serin, correct?
Not quite. For use with a 40-pin PICAXE -

Code:
                                     .----._.----.
                                    -| 1      40 |-
                                    -| 2      39 |-
         AXE029                     -| 3      38 |-
   .----------------.               -| 4      37 |-
  _|_.----.      oo |- N/C          -| 5      36 |-
 |   |    |   o  oo |- RXD ---> SI ->| 6      35 |-
 |_ _|    |  |o| oo |- TXD <--- SO --| 7      34 |-
   | `----'  |o| oo |- 0V ---.      -| 8      33 |-
   `----------------'        |      -| 9      32 |-
              |              |      -| 10     31 |-
       Fit link towards      |      -| 11     30 |-
          this side          `-------| 12     29 |-
                                    -| 13     16 |-

Edit; That means the ground pin on the adapter connects to pin 8, correct?
Only if you plug in the AXE029 adjacent to the PICAXE legs.

If you are able to keep pin A.5 (leg 8) an input you could connect leg 8 to 0V and then have the AXE029 adjacent to the PICAXE legs -

Code:
                                     .----._.----.
                                    -| 1      40 |-
                                    -| 2      39 |-
         AXE029                     -| 3      38 |-
   .----------------.               -| 4      37 |-
  _|_.----.      oo |- N/C          -| 5      36 |-
 |   |    |   o  oo |- RXD ---> SI ->| 6      35 |-
 |_ _|    |  |o| oo |- TXD <--- SO --| 7      34 |-
   | `----'  |o| oo |- 0V ---.- A5 ->| 8      33 |-
   `----------------'        |      -| 9      32 |-
              |              |      -| 10     31 |-
       Fit link towards      |      -| 11     30 |-
          this side          `-------| 12     29 |-
                                    -| 13     16 |-
Otherwise just mount the AXE029 somewhere else on the breadboard and use three jumper wires to connect it to the PICAXE legs.
 

Gramps

Senior Member
Quote"Use 3 jumper wires"
(User pounding head on breadboard) of course! You guys are so patient with me!
Thanks for clarifying that txd goes to leg 7 not 6.
 
Last edited:

Gramps

Senior Member
We are working on attempting to get to picaxe Editor to load on this Windows 10 machine. The installer attempts to load the program and after the files are open we get a screen that says the wizard will allow you to modify repair or remove picaxe Editor to continue click next when we click next we see modify repair or remove. We hit repair and it seems to completely load the program properly the Finish screen came up on the installer and we closed it.
The editor is listed in the program files but for some reason will not launch.
 
Top