Hi All,
Since my last post on this subject I've tested the 16F1847 in my custom pcb following a good compile and verification (after upgrading MPLAB/MPASM/PBP3).
The results are not good (please see attached files). The hardware is confirmed good as the GLCD displays "Hello World" correctly but fails miserably when the @ printstr x,y,"xxxxx" command is invoked. I've had good success using this and more on a 16F88 pic and I need something with more codespace.
If there are any takers out there with advice on how to crack this, you have my attention...
Code:
'*****************************************************************************
'* Name : Bill's Retic testing.pbp #### NON Working Code #### *
'* Author : WJ Sherwood *
'* Date : 02/05/18 *
'* Device : 16F1847 (8k code space) *
'* Version : 1.0 2588 words with PBP 3.0.10.4 *
'* Notes : *
'* : Hello World works fine but @ PrintStr 6,3,"Reticulation" does *
'* : not and causes strange effects. *
'* : *
'* : *
'*****************************************************************************
'
' Connections as follows:
'
' PIC(F1847) OTHER
' PortA.2 (pin 1) SDA on Nokia module.
' PortA.3 (pin 2) D/C on Nokia module.
' PortA.4 (pin 3) RST on Nokia module.
' MCLR PortA.5 (pin 4) 10k pullup to 5v via diode for ICSP.
' Vss Ground (pin 5) CS on Nokia module.
' PortB.0 (pin 6) Spare.
' PortB.1 (pin 7)
' PortB.2 (pin 8)
' (CCP1) PortB.3 (pin 9) Spare.
' PortB.4 (pin 10)
' PortB.5 (pin 11)
' PortB.6 (pin 12)
' PortB.7 (pin 13) Spare.
' Xtal PortA.6 (pin 15) Spare. LCD pin hard grounded.
' Vdd 5 volts (pin 14)
' Xtal PortA.7 (pin 16) LED indicator and optocoupler driver for Triac/solenoid valve.
' PortA.0 (pin 17) LED backlight on Nokia module.
' PortA.1 (pin 18) SCK on Nokia module.
' NOKIA 3310 LCD (eBay) MODULE PINOUT
' as viewed from the FRONT (left -> right)
' ---------------------
' | oooooooo | Note actual display area is 30x21mm.
' | 1 8 |
' ---------------------
' | |
' | |
' | |
' | |
' ---------------------
' | oooooooo |
' | 1 8 |
' ---------------------
'
'1 !rst portA.4
'2 !cs Gnd #### works fine grounded, saved a pin here.
'3 d/!c portA.3
'4 sda portA.2 (pulled high 4k7). Runs okay without it (pullup on pcb?).
'5 sclk portA.1
'6 vcc 3.3v
'7 Led portA.0 Gnd to light - connects to vcc (via smd resistor if solder JP near pin 8 top), max 3v3 supply!
'8 gnd
'=====================================================================================================
' CONFIGURE DEVICE
'=====================================================================================================
@ ERRORLEVEL -306 ; turn off crossing page boundary message
#CONFIG ; F1847.
__config _CONFIG1, _FOSC_INTOSC & _WDTE_ON & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF
__config _CONFIG2, _PLLEN_OFF & _LVP_OFF
#ENDCONFIG
' -----[ Initialization ]------------------------------------------------------------------------------------------------
clear ' ****** Clear statement must be before any INC file.******
Include "MODEDEFS.BAS" ' Include Shiftin/out modes.
include "LCD_3310v32 WJS.inc" ' Edited for current hardware connections.
TRISA = %00000000 ' All outputs.
TRISB = %00000000 ' All outputs.
ANSELA = 0 ' Turn off analog port A
ANSELB = 0 ' Turn off analog port B
CM1CON0 = 0 ' Comparators off.
CM1CON1 = 0
CM2CON0 = 0 ' Comparators off.
CM2CON1 = 0
CPSCON0 = 0 ' Capacitive sense module off.
OSCCON = %01101010 ' 4Mhz (F1847).
' INTCON = %00001000 ' B.3 = 1 - Interrupt on change Enable bit.
' IOCBN = %00110000 ' Enable IOC falling edge on PORTB.4-5 (pulled up).
' IOCBP = 0 ' Disable IOC rising edge on PORTB.
' Stored onboard E2...
Message Data "Bill's DIY Retic testing"
'=====================================================================================================
' PIN ASSIGNMENTS, SYSTEM CONSTANTS, TEMPORARY VARIABLES
'=====================================================================================================
' Alias pins
Triac var PortA.7 ' Optocoupler drives the triac/solenoid.
GOTO Satu ' Jump over the subroutines area.
'=====================================================================================================
' Subroutines here in the first page...
'=====================================================================================================
Splash: ' Show opening screen.
'@ PrintStr 12,2,"Bill's DIY" ; the single quote causes problems within the asm - workaround below.
'@ PrintStr 12,2,"Bill" ; First part.
' Lcd_Data = "'" ' Note byte size single char.
' Gosub Lcd_SendChar '
'@ PrintStr 42,2,"s DIY" ; Final part.
@ PrintStr 6,3,"Reticulation" ; Line 4.
@ PrintStr 18,4,"02May18" ; Line 5.
@ PrintStr 0,5,"Push to select" ; Line 6.
return
'=====================================================================================================
' Program area...
'=====================================================================================================
Satu: ' Operation when system first powered up.
pause 1000
pulsout Triac, 20000 ' Heartbeat for testing, 200ms.
gosub Lcd_Init ' Initialize LCD.
gosub Scr_Normal ' Normal Black on White.
Gosub Splash ' Show opening screen.
pause 3000 ' 3 seconds.
gosub Lcd_Clear ' Clear contents of screen
pause 50
PosX = 30:PosY = 0:gosub Lcd_GotoXY ' position 30 of 84 in the x direction, row 0 (of 0 to 5)
Lcd_Data = "H"
gosub Lcd_SendChar
Lcd_Data = "E"
gosub Lcd_SendChar
Lcd_Data = "L"
gosub Lcd_SendChar
Lcd_Data = "L"
gosub Lcd_SendChar
Lcd_Data = "O"
gosub Lcd_SendChar
PosX = 30:PosY = 1:gosub Lcd_GotoXY ' position 30 of 84 in the x direction, row 1 (of 0 to 5)
Lcd_Data = "W"
gosub Lcd_SendChar
Lcd_Data = "O"
gosub Lcd_SendChar
Lcd_Data = "R"
gosub Lcd_SendChar
Lcd_Data = "L"
gosub Lcd_SendChar
Lcd_Data = "D"
gosub Lcd_SendChar
Lcd_Data = "!"
gosub Lcd_SendChar
pause 1000 '
gosub Lcd_Clear ' Clear contents of screen
goto Satu ' Repeat
end
LCD_3310v32 WJS.inc.txt
FWIW there is a similar thread I posted under "Using Nokia LCD" today concerning the troublesome 16F1847 but using mister_e's Nokia wrapper (which succeeds Scale Robotics' earlier macro used in this Hello World example)... I'm sure there is a common problem with both.
Best regards,
Bill
Bookmarks