Electronic Circuits and Projects Forum



How to start PIC16F676 ...??

« First 12345678915 ... Last »
  1. #41
    ericgibbs ericgibbs is offline
    Super Moderator
    hi Ian,
    Sent you a PM about 1hr ago, ref this ADC setup problem on OSH.

    E.
    +1
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    "Nigels Asm tutorials:" www.winpicprog.co.uk/
    "Ian Rogers 'C' conversion of Nigels Asm tutorials:" http://www.electro-tech-online.com/c...torials-c.html

  2. #42
    Ian Rogers Ian Rogers is online now
    Super Moderator
    0x3D14 IS only 14 bits!! 11 - 1101 - 0001 - 0100. the ' D' really should be 1 as bits 12,11 and 10 are unused..
    +1
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

  3. Thread Starter #43
    RITESH KAKKAR RITESH KAKKAR is offline
    I want to clear this why there is double __ underscore???
    __config 0x3D14
    Attached Images
    0
    Last edited by RITESH KAKKAR; 10th March 2012 at 12:19 PM.

  4. Thread Starter #44
    RITESH KAKKAR RITESH KAKKAR is offline
    so, we are using this Oscillator:-
    100 = INTOSC oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN

    and
    MCLRE: RA3/MCLR pin function select(5)
    1 = RA3/MCLR pin function is MCLR
    what does this mean?
    bit 13-12 BG1:BG0: Bandgap Calibration bits for BOD and POR voltage(1)
    00 = Lowest bandgap voltage
    11 = Highest bandgap voltage

  5. #45
    Ian Rogers Ian Rogers is online now
    Super Moderator
    New code for you ritesh..... Put this into oshonsoft assembler it works ok now

    Code :
    	;include "P16F676.inc"		;include the defaults for the chip
    	__config 0x3114			;sets the configuration settings (oscillator type etc.)
    							; HERE SET TO INTERNAL OSCILLATOR 4MHZ
    	ORG 0
    	GOTO INIT
     
    INIT
    	CLRF OPTION_REG
    	BSF STATUS,RP0
    	CLRF VRCON
    	MOVLW 0x3f
    	MOVWF TRISA 	; porta as input
    	MOVLW 0x0
    	CLRF ANSEL 	; disable ADC
    	MOVWF TRISC 	; portb as output
    	BCF STATUS,RP0
    	MOVLW 0x7
    	MOVWF CMCON
     
    START
     
    	btfss PORTA,1 	; test bit 1
    	call delay
     
    	GOTO START
     
    delay
    	movlw 0xff
    	movwf PORTC 
    	movlw 0fh
    	movwf 0x21
    	dECfsz 0x21,f
    	clrf PORTC
    	RETURN
     
    end

    Band gao voltage associated with BOD & POR Brown Out Detect and Power On Reset Read section 9.3.5 on this topic.
    +1
    Last edited by Ian Rogers; 10th March 2012 at 12:35 PM.
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

  6. Thread Starter #46
    RITESH KAKKAR RITESH KAKKAR is offline
    Thanks the code are working ...
    ORG 0
    GOTO INIT
    What the need of this can't we start normally?
    please explain more this part of code...

    CLRF OPTION_REG??
    CLRF VRCON??

  7. #47
    Ian Rogers Ian Rogers is online now
    Super Moderator
    Quote Originally Posted by RITESH KAKKAR View Post

    please explain more this part of code...

    CLRF OPTION_REG??
    CLRF VRCON??
    I was just trying to find out why the ADC wasn't being turned off.

    VRCON is for the voltage reference module (it's unused, so I disabled it)
    OPTION_REG has interrupt settings so I disabled them all.

    ORG 0
    GOTO INIT

    Try to get into the habit of including this. When you use tables and interrupts you'll need to jump over them.
    +1
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

  8. #48
    ericgibbs ericgibbs is offline
    Super Moderator
    0
    Eric " Good enough is Perfect "
    I will NOT answer PM's requesting technical help, please use the Forum
    "Nigels Asm tutorials:" www.winpicprog.co.uk/
    "Ian Rogers 'C' conversion of Nigels Asm tutorials:" http://www.electro-tech-online.com/c...torials-c.html

  9. Thread Starter #49
    RITESH KAKKAR RITESH KAKKAR is offline
    Please clear one more doubt __config why two underscore not single is that also set in data sheet??

  10. #50
    Ian Rogers Ian Rogers is online now
    Super Moderator
    __config is a makro.. written by someone in microchip... To know why there is two underscores you'll need to find him and ask him.

    Usually the underscore is used in C for assembler routines... purely for keeping identifiers apart.... If it was declared just config... It would mean no-one could use this identifier.

    The datasheet may well have two, its depends on the font used.

    Sorry... Its a directive for the assembler / linker, not a makro.....
    +1
    Last edited by Ian Rogers; 10th March 2012 at 03:07 PM.
    I'd give my left arm to be ambidextrous
    Nigel's tutorials in asm... http://www.winpicprog.co.uk/
    Nigel's tutorials.. re-written in C. http://www.electro-tech-online.com/c...torials-c.html

« First 12345678915 ... Last »
Tags
Similar Threads
Thread Starter Forum Replies Last Post
How to start with analog soundboard? Ibanezarus General Electronics Chat 3 11th July 2006, 08:14 AM
how to start to develop SIM card reader janetsmith2000@yahoo.com Microcontrollers 4 21st June 2005, 09:59 AM
how to start gastonanthony Microcontrollers 1 9th April 2005, 09:40 AM
Assembly language - how to start ?? - help~ soohino Microcontrollers 1 4th January 2005, 03:42 PM
pic 16f876 programmer how to start stanley Electronic Projects Design/Ideas/Reviews 1 5th January 2004, 10:21 AM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.14571 seconds      Memory: 7,721 KB      Queries: 17      Templates: 0