Pic16f88 compiling. . not working


Closed Thread
Results 1 to 15 of 15
  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default Pic16f88 compiling. . not working

    Hello,

    I am trying to figure how to use MPLAB in windows 7. Have installe MPLAB version 8.63 along with picbasic pro 2.60C. My following code compiles with no error:
    'LCD testing program

    OSCCON = %01110000 '8 Mhz
    DEFINE OSC 8

    '/////////////////////////
    '// LCD configuration //
    '/////////////////////////

    DEFINE LCD_DREG PORTB ' Set LCD Data port
    DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTA ' Set LCD Register Select port
    DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTA ' Set LCD Enable port
    DEFINE LCD_EBIT 3 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 1000


    Mainloop:

    lcdout $FE,1, " This is a test" '
    lcdout $FE,$C0, "Next or Select" '
    pause 200

    GOTO Mainloop
    End

    Although it do not seems to work, nothing is showing on the LCD screen, just turns on.
    Using Pic16F88. Tried different chip, rewired.. nothing. any ideas ?

    Ken

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Sounds like you have 2 potential unknowns. From the sound of it, this is the first time you are using windows 7 and PBP. The second could be miss-wiring of the LCD. Try just getting an I/O port to turn on and off in a loop to make sure your MCU is actually running code. Put an LED or scope probe on portB.0 make sure your TRISB is set to digital output on bit 0.

    Main:
    portB.0 = 1
    pause 1000
    portB.0 = 0
    pause 1000
    goto main

    If the above runs, then recheck your LCD.

    Nick

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    I used XP mode, to run 32 bit application. I compile it under dos and the program works fine including the LCD ..

    ken

  4. #4
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    It's in your first row something like this :
    @ DEVICE pic16F88, XT_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON ?

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    here is the code:
    'LCD testing program

    @ DEVICE pic16F88, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON
    OSCCON = %01110000 '8 Mhz
    DEFINE OSC 8

    '/////////////////////////
    '// LCD configuration //
    '/////////////////////////

    DEFINE LCD_DREG PORTB ' Set LCD Data port
    DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
    DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB ' Set LCD Enable port
    DEFINE LCD_EBIT 1 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 1000


    Mainloop:

    lcdout $FE,1, " This is a test" '
    lcdout $FE,$C0, "Next or Select" '
    pause 200

    GOTO Mainloop
    End


    and here is the error message:
    Executing: "C:\PBPDEMO\PBPW.EXE" -ampasmwin -k# -p16F88 "lcdtest.bas"
    PICBASIC PRO(TM) Compiler 2.60C, (c) 1998, 2011 microEngineering Labs, Inc.
    All Rights Reserved.

    ERROR: Unable to execute mpasmwin.Warning[207] C:\PBPDEMO\LCDTEST.ASM 117 : Found label after column 1. (DEVICE)
    Error[122] C:\PBPDEMO\LCDTEST.ASM 117 : Illegal opcode (pic16F88)
    Halting build on first failure as requested.
    BUILD FAILED: Sun Oct 30 00:00:24 2011


    ken
    but it does compile if I remove this line:
    @ DEVICE pic16F88, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON

    but nothing happens on the LCD

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    My MPlab is configures as following when I go into the language tools option.. in the executable:

    C:\PBP\PBPMPLAB.BAT

    K

  7. #7
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    579


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Do you have this setting ?
    Attached Images Attached Images  

  8. #8
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    I dont have microcode studio, just MPLab and a plain text editor..

  9. #9
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Micro Code Studio ships with PBP. It is on your install CD.
    Dave
    Always wear safety glasses while programming.

  10. #10
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Here is the configuration I have:
    Name:  mcs1.jpg
Views: 387
Size:  440.1 KBName:  mcs2.jpg
Views: 383
Size:  442.2 KB

  11. #11
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Did you notice that it selected the assembler from your recycle bin?

    Also, it has been several years since I worked with the 16f88, but iirc it has at least one of the peripherals enabled by default. You must go through each and every pin used with the lcd and make sure it is configured to be a regular i/o pin, and not configured as a peripheral pin.

  12. #12
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    Yes I saw it refers to the recycling bin. although it does not find it automatically. and I do not know what to choose. The help file in the micro code studio is not very helpful in that regard.

    k

  13. #13
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    by removing this line:
    @ DEVICE pic16F88, INTRC_OSC, WDT_OFF, PWRT_OFF, BOD_OFF, MCLR_ON
    the code compiles but does not create the hex file !!

    k

  14. #14
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    although it does not find it automatically. and I do not know what to choose.
    MPASM should be C:\Program Files\Microchip\mpasm suite

    or something like that.
    Dave
    Always wear safety glasses while programming.

  15. #15
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default Re: Pic16f88 compiling. . not working

    I installed version 4 of microCode studio, now it creates the Hex file.
    Aleluia !!

    K

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts