change AX133

emilio0

New Member
Good morning everyone,
To courtesy, I need to know, from some kind person who has more experience, especially on the two "Pinsc / DirSc" commands that I don't understand entirely.
My question concerns the AX133 software that drives from a parallel serial for the display 1602 using the 18m2 pins.
Now I would need free Pins B.4 and B.1 which are used by the "Let Dirsb" command to send the data to the display, using them as I2C bus to access external EEPROM.
So I ask if in addition to the HW modification of the Pins concerned the change can work by deviating signals B.4 and B.1 on C.1 and C.0 with Pinsc appropriate. The display still operates normally ???
Or the operation is irreversibly altered.
I searched around but I didn't find anything about it.

I would appreciate some advice, please.

(translated with Google)

Emilio
 

AllyCat

Senior Member
Hi,

Welcome to the forum. I will write in English and hope that Google does a good job. :)

It can be difficult to change the AXE133 program code, because the processing speed is very important. Perhaps increasing it to SETFREQ M32 (from SETFREQ M16) will help, but you may need to use other methods. For example, you might change the format of the "Host" (driver) program as follows (which you can test in the PE5 / PE6 Simulator) :

Code:
#PICAXE 08M2                                              ; Or any other PICaxe
     SEROUT  C.4 , N2400 , ("Hello World",CR,LF)       ; Might transmit characters too quickly so use :

     FOR b0 = 0 to 12                                    ; Start a loop
        LOOKUP b0 , ("Hello World",13,10) , b1        ; Read value into b1
        SEROUT C.4 , N2400 , (b1)                            ; Transmit value to serial LCD
         PAUSE  1                                     ; Probably not required
     NEXT b0                                           ; Next loop
For the AXE133 program it would then be possible to split the 8 bits of data across both Port B and Port C but this can be quite complicated. The method I would use is to drive the 1602 display in "4-bit Mode". The "initialization" is more complex and the data "throughput" is slower, but you need only 4 bits of Port B. The other "Control" bits (RS and En) can be on Port B or Port C pins. A "Reference Design" for this method is :

https://picaxeforum.co.uk/threads/universal-test-code-for-all-parallel-bus-alphanumeric-lcd-configurations.22573/

One way to re-arrange the bits can use maths , for example (untested) :
Code:
#PICAXE 18M2
Symbol RS     = C.0           ; Register select: Low for Commands, High for Characters
Symbol En     = C.1           ; Enable pin. Default condition is low. Pulse High to input data.
      DirsB = %111x1xxx     ; Pins B.7 to B.5 and B.3 are Outputs (x = 0 , or as required by main program)
Chr2LCD:       
      pinsB = char / 2 AND 8 XOR char AND 31 XOR char        ; High nibble (765-4---) sent first (To LCD pins 7 to 4)
      PulsOut En , 1                                         ; Clock four high bits of data into LCD
      pinsB = char AND 30 + char * 8                         ; Low nibble (321-0---) sent next (To LCD pins 7 to 4)
      PulsOut En , 1                                         ; Clock four low bits of data into LCD
Return
Cheers, Alan.
 
Last edited:

emilio0

New Member
hi AllyCat,
I really enjoyed your speed and coinciding for my question.
For the first for / next of the "host" program is simply basic for my purposes, (Lookup I've never used it) and solves some of my programs that have remarkable problems.
For the actual program, to understand it thoroughly (logical mathematical use) I will have to resume books in hand and to re-learn what I have now forgotten and never used.
I will try to install it and see the results obtained.
Thank you for time reserved for time hoping that others benefit from your information.
PS.
How long does the tread closed?
emilio

(translated with Google)
 

AllyCat

Senior Member
Hi,

The method of "Bit-Copying" shown by IngleWoodPete in the link in post #2 above is probably the easiest method when you understand that the "Byte Variable" B0 = bit7 : bit6 : bit5 : bit4 : bit3 : bit2 : bit1 : bit0 . However, my "mathematical" (Logic) method can use any Byte Variable. Therefore, do not study for too long with it, but the following may help:

Code:
char         =   7    6    5    4    3    2    1    0       ; Bits
/ 2          =   o    7    6    5    4    3    2    1       ; Shift Right (>>)
AND 8        =   o    o    o    o    4    o    o    o       ; o = Zero or Don't Care  (8 = %00001000)
XOR char     =   7    6    5    4   3^4   2    1    0       ; ^ = XOR (Exclusive OR)
AND 31       =   o    o    o    4   3^4   2    1    0       ; char XOR o = char  (31 = %00011111)
XOR char     =   7    6    5    o    4    o    o    o       ; XOR * XOR =  No change
----------
char         =   7    6    5    4    3    2    1    0       ; Bits
AND 254      =   7    6    5    4    3    2    1    o       ; (254 = %11111110   [or ANDNOT 1 is the same] *
+ char       =   6    5    4    3    2    1    o    0       ; Partial Shift Left (<<)
* 8          =   3    2    1    o    0    o    o    o       ; Shift Left (<<3)
*EDITED to correct and simplify logic

"PS:" Are you asking if a "Moderator" will close this Forum Thread after a time ? No, all threads will remain Open for comments or questions as long as the forum is here on the Web. ;)

Cheers, Alan.
 
Last edited:

emilio0

New Member
Hi
Thank you very much of the aid on Boolean mathematics that helps me to understand how to manage individual bits.

emilio

(translated with Google)
 
Top