News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Serout command

Started by JackB, Apr 23, 2024, 12:58 PM

Previous topic - Next topic

JackB

Hello everyone,


From Picaxe 08M2 chip to a 20x2 (FRM010) LCD display

I can send control characters and text with this command

SEROUT C.0,N4800_8,(254,128,"12345678901234567890")  ;  inverted baud signal

when using a 12F683 to 20x2 (FRM010) with this command (tried different GPIO.0,1,2,4,5)

and also use the "Pace" option


Dim N4800 As Word

N4800 = 16572  ;:N4800 INVERTED   188:T4800 TRUE
DelayMS 100
SerOut 1, N4800,[254,128,"12345678901234567890"]

it's not working

also the Rsout command has the same result

Declare Serial_Baud = 4800
Declare RSOut_Mode = 0 ; and 1
Declare RSOut_Pin = GPIO.1

RsOut 254,128, "1234567890"


what I'm missing here, is the serout / Rsout are similar as Picaxe & PBP3 command.

any clue is welcome.
Thanks to all.









JackB


Found the answer in the "Serout command" I had to use the Pace option, otherwise the LCD will not work properly.

I've post the code so if someone is looking to interface some Picaxe 20x2 and 12F683.

This is an adaptation from Revolution FRM010 the only downside it's working at N4800 Baud only but it does the job.


; AXE133 Serial LCD/OLED using PICAXE-20x2
; Emulates basic serial operation of the popular AXE033 module
; File  : "D:\Positron Code\12F683\12F683-20x2 FRM010 LCD Test\SERIAL LCD.bas"
; Note  : Test for Picaxe 20x2 LCD Backpack
; Chip  : 12F683,20x2
; Date  : Apr-23-2024
; Note  : Tested with Hitachi HD44780 LCD 2004/1602 Module
; Note  : LCD Commands reference from Revolution, "FRM010 Serial LCD Firmware"
; Display 1604
; Line  (16/car/Pos)
; Line 1: 128-  143
; Line 2: 192-  207
; Line 3: 144-  159
; Line 4: 208-  223
;
; Display 2004
; Line  (20/car/Pos)
; Line 1: 128-  148
; Line 2: 192-  211
; Line 3: 144-  163
; Line 4: 208-  227

Device = 12F683
Declare Xtal = 8 ; 4,8Mhz
Config  INTOSCIO, WDT_OFF, PWRTE_OFF, MCLRE_OFF, CP_OFF, CPD_OFF, BOD_ON, IESO_ON, FCMEN_ON

ANSEL = 0
CMCON0 = 7
TRISIO = %00001000
OSCCON = $70

Dim N4800 As Word
Dim Pc As Byte     ;use Pace 2 and up
Dim D1 As Byte     ;Delay for test
Pc = 2
D1 = 50

N4800 = 16572  ;N4800 Inverted   188:T4800 True ; for 20x2 use only N4800

DelayMS 200                    ; Let 20X2 to init the LCD
SerOut GPIO.1,N4800,Pc,[255,8] ; LCD Backlight On
DelayMS D1

; Test Lines
Do
    SerOut GPIO.1,N4800,Pc,[254,128,"1234567890ABCDEFGHIJ"] ; Line 1
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,192,"1234567890ABCDEFGHIJ"] ; Line 2
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,148,"1234567890ABCDEFGHIJ"] ; Line 3
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,212,"1234567890ABCDEFGHIJ"] ; Line 4
    DelayMS D1

    DelayMS 1000
    SerOut GPIO.1,N4800,Pc,[254,1] ; Clear LCD
    DelayMS 500
    SerOut GPIO.1,N4800,Pc,[255,0] ; LCD Backlight Off
    DelayMS 500
    SerOut GPIO.1,N4800,Pc,[255,8] ; LCD Backlight On

    SerOut GPIO.1,N4800,Pc,[254,128,"abcdefghijklmnopqrst"] ; Line 1
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,192,"abcdefghijklmnopqrst"] ; Line 2
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,148,"abcdefghijklmnopqrst"] ; Line 3
    DelayMS D1
    SerOut GPIO.1,N4800,Pc,[254,212,",./<>?!@#$%^&*()_+[]"] ; Line 4
    DelayMS 1000
Loop