help with pic16f887


Closed Thread
Results 1 to 40 of 61

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Up in post #3 you were using mpasm, now you are using PM with MPLAB...
    I do not understand.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default ?????

    owowo I am lost now

    -I was previously using Picbasic pro under dos.
    -Now I installed windows 7 64bit, I can no longer use dos. I followed the instruction from Melabs to choose PBPMPLAB.BAT under MPLAB 8.56. I thought I was using the picbasic pro module and MPLAB and an interface between the two.

    I want to keep it simple... either way , dont know where to go from here

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


    Did you find this post helpful? Yes | No

    Default

    Try installing the free version of Micro Code Studio that came with PBP.
    Then in the toolbar click View - Compiler and Program Options.
    There will be tabs on the dialog box.
    Under Compiler click find automatically.
    Under the Assembler tab check Use MPASAM and click find automatically.

    Then when you want to compile hit the F9 key.

    That is the simplest way.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Gee not compiling giving me one error and one warning:

    -Overwriting previous address content (2007)
    -Argument out of range. Least significant bits used


    and I did select the right chip....

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    ok knocked off this line
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF


    and its only giving the warning :-Argument out of range. Least significant bits used

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


    Did you find this post helpful? Yes | No

    Default

    If I remove the "e"
    Code:
    lcdout $FE,1, " Appuyé sur Start "
    And remove the space at
    RTCYear
    Code:
    I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCY ear,RTCCtrl] 'read clock
    It compiles.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Hi I finally got it to compile. Now I have a small problem writing to memory. Its actually not writing. and on the LCD its always showing 0000
    I have A0 and A1 to ground and A2 to 5v. on the eeprom 24LC1025, pins are configued correctly, is there anything in the program that will not allow a writing ???


    Code:
    '/////////////////////////
    '// EEPROM  test program
    '//	Using the PIC16F887
    '//
    '/////////////////////////
    
    '/////////////////////////
    '// Define section //
    '/////////////////////////
    
    '@ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _LVP_OFF & _CP_OFF
    'OSCCON = %01110000 '8 Mhz
    DEFINE OSC 8
    ANSELH = 0
    
    '/////////////////////////
    '// 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  RB.4, RB.5, RB.6, RB.7
    DEFINE LCD_RSREG PORTB 	' Set LCD Register Select port
    DEFINE LCD_RSBIT 1 		' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB	' Set LCD Enable port
    DEFINE LCD_EBIT 0 		' Set LCD Enable bit
    DEFINE LCD_BITS 4 		' Set LCD bus size (4 or 8 bits) '4 therefore put wire at 4, 5, 6 and 7 of LCD
    DEFINE LCD_LINES 2 		' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000
    pause 1000
    
    '/////////////////////////
    '// PIN configuration //
    '/////////////////////////
    
    TRISB = %00000000 ' Set PORTB to all output
    TRISA = %11111111 ' Set PORTA to all input
    TRISC = %11000000 ' Set PORTC to all output
    
    
    '///////////////////////////////////////////////
    '// Variable Declaration and initialization //
    '///////////////////////////////////////////////
    
    Battery_Switch var byte
    i var byte
    j var byte
    Battery_Charge_Counter var byte
    
    
    SDApin var PORTC.4                     ' RTC data 
    SCLpin var PORTC.3                     ' RTC clock
    bat var byte
    Write_Address var byte
    
    RTCSec var byte :RTCMin var byte :RTCHour var byte :RTCWDay var byte :RTCDay var byte :RTCMonth var byte :RTCYear var byte :RTCCtrl var byte 
    
    
    lcdout $FE,1, "Bienvenue"
    lcdout $FE,$C0, "Welcome" 
    pause 1500
    
    I2CWRITE SDApin,SCLpin,$A0,$00,[$03,$02,$05,$00,$00,$00,$00,$00] ' Write to  memory
       pause 20
       
    
    
    '////////////////////////////////////////////////////
    '////////////////// PROGRAM /////////////////////////
    '////////////////////////////////////////////////////
    
    Mainloop:
    
    	lcdout $FE,1, "Appuye sur Record"
    	lcdout $FE,$C0, "ou sur Show"
    	pause 200
    	
    
     
    if PORTC.7 =0 then      'always 5v, push button to gnd
    			j=1
    
    			I2CRead SDApin,SCLpin,$A0,$00,[RTCSec,RTCMin,RTCHour,RTCDay]
    			lcdout $FE,1, "  Time ", dec j
    			lcdout $FE,$C0, dec RTCDay, dec RTCHour, dec RTCMin, dec RTCSec
    			pause 2000
    
    Endif
    			
    goto Mainloop
    End

Members who have read this thread : 0

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