16F628 does not run. I can't believe this


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807

    Default 16F628 does not run. I can't believe this

    I have been trying all day to run this program on a 16F628 and the damn thing does not.

    I can't believe that I cannot make it run. Oh God I am gonna smash it.

    I'll give it a chance.

    Please if anyone can see what I am missing, please help.

    Chip is 16F628 with ceramic resonator. Checked the freq and is close to 4MHz. Also the Option_Reg seems to be configured OK because of the Pull ups checked on port B, but then, nothing happens...

    Code:
    DEFINE OSC 4
    INCLUDE "C:\PBP\MODEDEFS.BAS"
    
    ;----- Configuration bits ------------------------------------------------
    
    @Line1 = _LVP_OFF & _BODEN_ON & _DATA_CP_ON
    @Line2 = _CP_ALL & _MCLRE_ON & _PWRTE_ON & _WDT_ON & _XT_OSC
    
    @ __CONFIG Line1 & Line2
    
    cmcon=7	    		'disable portA comparators
    intcon=0		'disable interrupts
    vrcon=0			'disable reference voltage output at porta.2
    
    TRISA = %00000000	'PA0:
    			'PA1:
    			'PA2:
    			'PA3:Relay
    			'PA4:Buzzer
    			'PA5:
    
    TRISB = %01110010	'PB0:
    			'PB1:Serial Input
    			'PB2:Serial Output
    			'PB3:RS485 Direction
    			'PB4:D0
    			'PB5:D1
    			'PB6:Button
    			'PB7:
    
    option_reg=%00000000
    
    relay       var porta.3
    buzzer      var porta.4
    
    dir         var portb.3
    d0          var portb.4     'Wiegand D0 input
    d1          var portb.5     'Wiegand D1 input
    but         var portb.6	'Button input	
    
    data_array  var byte[3]     'Wiegand data array
    byte_1      var data_array[2]
    byte_2      var data_array[1]
    byte_3      var data_array[0]
    
    clear
    high buzzer:pause 500:low buzzer
    
    stop
    
    end
    Ioannis

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default

    OK. I found it. How silly I was. RA4 is output but also Open Drain...

    Ioannis

Similar Threads

  1. Program compiles and writes but can't run
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 23rd March 2009, 04:38
  2. 16F628 problems
    By fowardbias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 11th January 2006, 07:38
  3. Interface DB-25 Female Connector to PIC 16F628
    By JoeCJK in forum Schematics
    Replies: 0
    Last Post: - 20th April 2005, 05:06
  4. SERIN2 not working with 16F628
    By d1camero in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th May 2004, 20:37
  5. 16F628 on-chip eeprom problem
    By atomski in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 4th March 2004, 07:43

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