>your a sweetheart.
I know.
>it works fine using this method now for the million dollar question why??/
Because I programmed it.
>dont know what to do to get it to function out of microstudio
Neither do I - I don't use those things...
>any help?//\
Not with Microcode studio
>thanks
You're welcome
Now let's move on and get your LCD working... connect it as per Page 96 of the manual, copy and save the below code, and compile as before... Remove the LED from PortA.0 but keep the one on PortB.0 - the blinking LED is there to tell you it's all working...
Code:' ' Device Programming Options ' -------------------------- @ DEVICE pic16F628, INTRC_OSC_NOCLKOUT ' System Clock Options @ DEVICE pic16F628, WDT_ON ' Watchdog Timer @ DEVICE pic16F628, PWRT_ON ' Power-On Timer @ DEVICE pic16F628, BOD_ON ' Brown-Out Detect @ DEVICE pic16F628, MCLR_OFF ' Master Clear Options (Internal) @ DEVICE pic16F628, LVP_OFF ' Low-Voltage Programming @ DEVICE pic16F628, CPD_OFF ' Data Memory Code Protect @ DEVICE pic16F628, PROTECT_OFF ' Program Code Protection ' ' Hardware Assignments ' -------------------- LEDB var PortB.0 ' ' LCD Display ' ----------- Define LCD_DREG PORTA ' Port for LCD Data Define LCD_DBIT 0 ' Use upper 4 bits of Port Define LCD_RSREG PORTA ' Port for RegisterSelect (RS) bit Define LCD_RSBIT 4 ' Port Pin for RS bit Define LCD_EREG PORTB ' Port for Enable (E) bit Define LCD_EBIT 3 ' Port Pin for E bit Define LCB_BITS 4 ' Using 4-bit bus Define LCD_LINES 2 ' Using 2 line Display Define LCD_COMMANDUS 2000 ' Command Delay (uS) Define LCD_DATAUS 50 ' Data Delay (uS) ' ' Initialise PIC ' -------------- TRISA=%00000000 ' PortA all OUTPUT TRISB=%00000000 ' PortB all OUTPUT CMCON=%00000111 ' Comparators OFF Pause 2000 ' wait for LCD to wake-up ' ' Main Program ' ------------ Loop: LCDOut $FE,1,"Hello" Pause 500 LCDOut $FE,1 Toggle LEDB Pause 500 Goto Loop ' End




Bookmarks