Using "END" Fries PICS?


Results 1 to 14 of 14

Threaded View

  1. #3
    Join Date
    Dec 2014
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Using "END" Fries PICS?

    I'm using an old MELabs USB Programmer and melabs Programmer V 4.51 beta software. I have NOT write protected the 16F819 chip. I have it configured such:
    osc = INTRC
    WDT = enabled
    Power up timer = Enabled
    MCLR pin funct = input pin
    Brownout reset = Enabled
    Low voltage programming = Disabled
    CCP multiplex = RB2
    Flash prog mem write enable = All
    code = Not Protected
    Data EEPROM = Not Protected

    Here is my code:
    Code:
     INCLUDE "modedefs.bas"
    define osc 4
    osccon= %01100000
    
    DEFINE	ADC_BITS	8	'this sets number of a/d bits, using 10 gives much higher resolution
    DEFINE	ADC_CLOCK	2	'choose clock source for a/d, 2 gives a stable reading
    DEFINE	ADC_SAMPLEUS	50	'sample wait time 50 microseconds
    'LCD declarations-------------
    CR	CON	13	'carriage return
    LF	CON	10	'cursor down one line keeps horiz position
    crsrH	CON	1	'home cursor
    bell	CON	7	'beep
    clrlcd	CON	12	'clear the lcd
    poscmd	CON	16	'position cursor
    N9600	CON	$4054	'value for 9600 baud setting
    
     PORTA = 0
     PAUSE 1
     PORTB = 0
     PAUSE 1
     
     trisa = %11000001
     trisb = %00000000
     ADCON1 = %00001110
     commpin		VAR	porta.4	'serial pin to LCD
     
     Button1 var porta.1
     
      MuxOutput var byte
      SwSelect var byte
      SwSelect = 8
      
    pause 1000
    
    GoSub kls
    
     SerOut2 commpin,n9600,[CLRLCD,bell]
    
     pause 100
    
    mainloop:
    
    end 'NEVER use "end"!!!!  it destroys the chip!
    
    portb = swselect
    
    adcin 0,muxoutput
    
    gosub lcdtext
    
    gosub SelectSwitch
    
    gosub button1NOTpressed
    
    goto mainloop
       
    SelectSwitch:
    Swselect=swselect + 1
        if swselect = 16 then
            swselect = 8
        endif
    return    
    
    lcdtext:
    SerOut2 commpin,n9600,[crsrh,"T",dec (portb-7),"=",dec muxoutput,"   REQ=",bin portb,"     "]
    SerOut2 commpin,n9600,["                    ",lf]
    return
    
    button1NOTpressed:
    adcin 0,muxoutput
    gosub lcdtext
    	IF button1 = 1 Then 
            GoTo button1NOTpressed 		'hold here until button released
    	EndIF
    	gosub button1pressed
    Return
    
    
    
    button1pressed:
    	IF button1 = 0 Then 
            GoTo button1pressed 		'hold here until button released
    	EndIF
    Return
    
     'Clears LCD screen --------------
    
    KLS:
    SerOut2 commpin,n9600,[clrlcd]
    Return
    
    beep:
    	SerOut2 commpin,n9600,[bell]			'tech 8 beep
    Return
    
    End
    After programming the chip, it never programs again. All I get when trying to reprogram is the error message "Target Device does not match selected device".
    Last edited by Archangel; - 16th December 2014 at 20:02.

Similar Threads

  1. Replies: 0
    Last Post: - 14th November 2013, 03:32
  2. Replies: 3
    Last Post: - 15th October 2012, 08:06
  3. Replies: 7
    Last Post: - 21st July 2011, 10:34
  4. Using "END" in a subroutine?
    By Byte_Butcher in forum General
    Replies: 6
    Last Post: - 13th February 2010, 16:32

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