a pic12f1xxx is an enhanced midrange device . they have twice the stack capacity of a 12f6xx device , apart from more memory etc ....
a pic12f1xxx is an enhanced midrange device . they have twice the stack capacity of a 12f6xx device , apart from more memory etc ....
Thanks to everyone that helped out.
I have gotten a modified version of Darrel's code to run on a 12F683 which has 2K of memory.
I am using an LCD 1602 and I don't see any Jumping Jacks.
Code:; Filename : 632-I2C-LCD for 12F683.pbp ; Author : Darrel Taylor ; Created : Mon Feb 24 2014 ; : May 27, 2015 adapted for the 12F683 ; Processor : PIC12F683 ; Compiler : PicBasic Pro 3.0.7.x or higher ; Description : Uses PCF8574 Port expander to interface with HD44780 LCD ; ;----[Oscillator Setup]--------------------------------------------------------- define OSC 20 define I2C_SLOW 1 ;----[Aliases]------------------------------------------------------------------ SDA VAR GPIO.0 ; I2C Data pin SCL VAR GPIO.1 ; I2C Clock Pin ;----[Initialize Hardware]------------------------------------------------------ ANSEL = 0 ; Make Analog inputs digital ';----[Setup LCD using PCF8574 Port Expander]------------------------------------ LCD_Addr CON $40 ; A0, A1, A2 grounded true con 1 false con 0 INCLUDE "LCD_PCF8574.pbp" ; Init LCD using I2C and PCF8574 ;----[Variables]---------------------------------------------------------------- LoopCount VAR BYTE CustChar VAR BYTE ;----[Program Start]------------------------------------------------------------ Backlight = 0 ; Turn on LCD Backlight LoopCount = 0 ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff ;----[Custom Characters]-(Jumping Jacks)---------------------------------------- ARRAYWRITE LCD_Buff,[$FE,$40,$00,$04,$0A,$04,$0E,$15,$0A,$11]:LCD_WriteBuff ' #0 ARRAYWRITE LCD_Buff,[$FE,$48,$00,$04,$0A,$04,$1F,$04,$0A,$0A]:LCD_WriteBuff ' #1 ARRAYWRITE LCD_Buff,[$FE,$50,$04,$0A,$15,$0E,$04,$0A,$0A,$00]:LCD_WriteBuff ' #2 ;----[Main Program Loop]-------------------------------------------------------- Main: ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff PAUSE 200 LoopCount = LoopCount + 1 CustChar = LoopCount//3 ; Jumping Jacks Sequence ARRAYWRITE LCD_Buff,[$FE,$9D,CustChar] : LCD_WriteBuff GOTO Main
Commented out the lines...
ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff
and
ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff
Changed the $9D to a $C0 in
ARRAYWRITE LCD_Buff,[$FE,$C0,CustChar] : LCD_WriteBuff ' $C0 was $9D
and now the little guy is doing Jumping Jacks in the lower left hand corner.
Thanks again!
I am trying to make this code work with a 16F629A and all I get is a blinking back light with the modified code below.I am probably missing something simple?
Thanks,
; Filename : Test_LCD_PCF8574.pbp
; Author : Darrel Taylor
; Created : Mon Feb 24 2014
; Processor : 16F629A
; Compiler : PicBasic Pro 3.0.6.x or higher
; Description : Uses PCF8574 Port expander to interface with HD44780 LCD
;
;----[16f629A Hardware Configuration]-------------------------------------------
#config
__config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_ON & _BODEN_OFF
#endconfig
;----[Aliases]------------------------------------------------------------------
SDA var porta.7
SCL var porta.6
;----[Initialize Hardware]------------------------------------------------------
CMCON = 7 'CHANGES PORTA TO DIGITAL
;----[Setup LCD using PCF8574 Port Expander]------------------------------------
LCD_Addr CON $7E
INCLUDE "LCD_PCF8574.pbp" ; Include LCD module for PCF8574
;----[Variables]----------------------------------------------------------------
LoopCount VAR BYTE
CustChar VAR BYTE
;----[Program Start]------------------------------------------------------------
Backlight = 0 ; Turn on LCD Backlight
ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff
LoopCount= 0
;----[Custom Characters]-(Jumping Jacks)----------------------------------------
ARRAYWRITE LCD_Buff,[$FE,$40,$00,$04,$0A,$04,$0E,$15,$0A,$11]:LCD_WriteBuff ' #0
ARRAYWRITE LCD_Buff,[$FE,$48,$00,$04,$0A,$04,$1F,$04,$0A,$0A]:LCD_WriteBuff ' #1
ARRAYWRITE LCD_Buff,[$FE,$50,$04,$0A,$15,$0E,$04,$0A,$0A,$00]:LCD_WriteBuff ' #2
;----[Main Program Loop]--------------------------------------------------------
Main:
ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff
PAUSE 200
LoopCount = LoopCount + 1
CustChar = LoopCount//3 ; Jumping Jacks Sequence
ARRAYWRITE LCD_Buff,[$FE,$C0,CustChar] : LCD_WriteBuff
GOTO Main
I did delete these two lines
ARRAYWRITE LCD_Buff,[" LCD PCF8574"] : LCD_WriteBuff
ARRAYWRITE LCD_Buff,[$FE,$C0,"Count = ",DEC LoopCount," "] : LCD_WriteBuff
and Change this line
ARRAYWRITE LCD_Buff,[$FE,$C0,CustChar] : LCD_WriteBuff ' $C0 was $9D
16F629A ?
might you mean 12f629 ?
if so you need to set the " lcd " pins to digital
Warning I'm not a teacher
Sorry, I should have said 16F628A. I did set my pins as digital? I want to display data from my program but that seems far away at this point?? I cut the program down to the below lines and I get a custom character and a blinking cursor the backlight stays on. I guess that is progress ?
Thank You!
;----[16f628A Hardware Configuration]-------------------------------------------
#config
__config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_ON & _BODEN_OFF
#endconfig
SDA var porta.7
SCL var porta.6
;----[Initialize Hardware]------------------------------------------------------
CMCON = 7 'CHANGES PORTA TO DIGITAL
;----[Setup LCD using PCF8574 Port Expander]------------------------------------
LCD_Addr CON $7E
INCLUDE "LCD_PCF8574.pbp" ; Include LCD module for PCF8574
ARRAYWRITE LCD_Buff,[$FE,$50,$04,$0A,$15,$0E,$04,$0A,$0A,$00]:LCD_WriteBuff ' #2
Main:
GOTO Main
Bookmarks