Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

what is a microcontroller made of ?

Status
Not open for further replies.

pinblaster73

New Member
hello, i'm new here, and i was wondering what a PIC, or any other microcontroller is made of (a diagram, or picture would be great). i have done searching and i think i found the answer a (bunch of transistors), however i may be wrong, and i still don't see how a bunch of electronic components can perform functions like adding, and timing/ticking. i also don't see how a bunch of these components can be programmed which brings me to my next question, i just bought **broken link removed** PIC programmer, and currently have an 18F2550 PIC attached to it. i have no clue how to even access it to program it so a tutorial would be extremely helpful if anyone has an thing like that.
 
I remember seeing a nice diagram in Myke Predko's "Programming and Customizing PICMicro...". And I'm sure "The Art of Electronics" has a good explanation of basic computers.

You might also try howstuffworks.com.

Check the sticky at the top of the forum for tutorials.

Mike
 
How do you have a PIC and a programmer, but not a clue? I was on the internet for months after I decided to learn microcontrollers. I looked at doezens of data sheets, so many tutorials, examples and projects, before choosing AVR (Tiny13L), also Atmel had a new USB programmer (AVR Dragon) for $50. I was reasonable prepared before the programmer and parts arrived. Was a little bummed that the programmer came with no documentation, cables, or jumpers.

Anyway, while deciding on which chip was best for my needs, I learned that PIC is the most widely used on the internet. Nothing even comes close to the vast amount of user information availiable. Nigel (our Moderator, ususually a great guy), has a website with PIC tutorials, with useful projects. It got some good info there, and I don't even use PIC.

By the time I got everything together, software download installed, cables bought/made, I had that first 'flash the LED' done in minutes, a maybe 20 minutes later I had 5 in sequence, back and forth. So many ideas, to choose from, many features to figure out how to configure.

So, how did your PIC and programmer magically appear before you? What were you planning, before the purchase? Perhaps a friend found it too hard, and dumped it off...

Sorry about all that. Use Google for your part, programmer, or project. You should get many useful hits. Definately want to check out Nigel's site, even if he doesn't use your part, lots of good information that can be used with any microcontroller.
 
cool, thank you for the info guys, and i was trying two projects, the **broken link removed**, and the **broken link removed**.
 
The progression goes something like this:
Transistors are used to build logic gates called AND, OR, NOT and others
Logic gates are used to build flip-flops, a basic memory device
Logic gates are used to build other combinatorial devices like decoders, multiplexers, adders, and Arithmetic Logic Units.
Flip-Flops are used to build registers, counters, shifters
Flip-flops and gates are used to build sequencers, or state machines
Throw these all together and you get a microprocessor.
 
Then take that microprocessor, and add:

Inputs
Outputs
Memory
Timers
maybe some Analog to digital converters
and possibly a built in crystal oscillator

and you have a microcontroller!
 
Built in crystal oscillator? Is there such a micro chip? Or are you just referring to standard RC oscillators?
 
What's on the chip would be all of the oscillator parts EXCEPT the crystal itself and possibly some load capacitors.
 
I assume you've downloaded and installed WINPIC800. Then I assume you've downloaded and read the following:
https://www.electro-tech-online.com/custompdfs/2007/05/ART2003-LVP.pdf
which tells you exactly how to setup and use WINPIC800 with your programmer.
Then I assume you've downloaded MPLAB from www.microchip.com and installed it. Here's a code template that will flash a LED and is a good starting point for assembler with the 18F2550:

Code:
;******************************************************************************
;   This code uses the HS-PLL oscillator config with an 8Mhz crystal. It will *
;   flash a LED at a one second rate on port A RA0 ( Pin 2 )                  *
;   This file is a basic template for assembly code for a PIC18F2550. Copy    *
;   this file into your project directory and modify or add to it as needed.  *
;                                                                             *
;   The PIC18FXXXX architecture allows two interrupt configurations. This     *
;   template code is written for priority interrupt levels and the IPEN bit   *
;   in the RCON register must be set to enable priority levels. If IPEN is    *
;   left in its default zero state, only the interrupt vector at 0x008 will   *
;   be used and the WREG_TEMP, BSR_TEMP and STATUS_TEMP variables will not    *
;   be needed.                                                                *
;                                                                             *
;   Refer to the MPASM User's Guide for additional information on the         *
;   features of the assembler.                                                *
;                                                                             *
;                                                                             *
;******************************************************************************
;                                                                             *
;    Filename: 18F2550temp.asm                                                *
;    Date:     JAN 14, 2005                                                   *
;    File Version: 1.0                                                        *
;                                                                             *
;    Author: KIM CHRISTENSEN                                                  *
;    Company:                                                                 *
;                                                                             * 
;******************************************************************************
;                                                                             *
;    Files required:         P18F2550.INC                                     *
;                                                                             *
;******************************************************************************

	LIST P=18F2550		;directive to define processor
	#include <P18F2550.INC>	;processor specific variable definitions

;******************************************************************************
;Configuration bits
; The __CONFIG directive defines configuration data within the .ASM file.
; The labels following the directive are defined in the P18F2550.INC file.
; The PIC18F2455/2550/4455/4550 Data Sheet explains the functions of the
; configuration bits.

	__CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC4_PLL6_1L & _USBDIV_2_1L
	__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEM_OFF_1H & _IESO_OFF_1H
	__CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_21_2L & _VREGEN_ON_2L
	__CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_1_2H 
	__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H 
	__CONFIG _CONFIG4L, _DEBUG_OFF_4L & _XINST_OFF_4L & _LVP_ON_4L & _STVREN_OFF_4L & _ICPRT_OFF_4L
	__CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
	__CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
	__CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
	__CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H & _WRTD_OFF_6H
	__CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
	__CONFIG _CONFIG7H, _EBTRB_OFF_7H

;******************************************************************************
;Variable definitions
; These variables are only needed if low priority interrupts are used. 
; More variables may be needed to store other special function registers used
; in the interrupt routines.

		CBLOCK	0x060
		WREG_TEMP	;variable used for context saving 
		STATUS_TEMP	;variable used for context saving
		BSR_TEMP	;variable used for context saving
		ENDC

		CBLOCK	0x000
		EXAMPLE		;example of a variable in access RAM
		TEMP
		TEMP2
		ENDC

;******************************************************************************
;EEPROM data
; Data to be programmed into the Data EEPROM is defined here

;		ORG	0xf00000

;		DE	"Test Data",0,1,2,3,4,5

;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.

		ORG	0x0000

		goto	Main		;go to start of main code

;******************************************************************************
;High priority interrupt vector
; This code will start executing when a high priority interrupt occurs or
; when any interrupt occurs if interrupt priorities are not enabled.

		ORG	0x0008

		bra	HighInt		;go to high priority interrupt routine

;******************************************************************************
;Low priority interrupt vector and routine
; This code will start executing when a low priority interrupt occurs.
; This code can be removed if low priority interrupts are not used.

		ORG	0x0018

		movff	STATUS,STATUS_TEMP	;save STATUS register
		movff	WREG,WREG_TEMP		;save working register
		movff	BSR,BSR_TEMP		;save BSR register

;	*** low priority interrupt code goes here ***


		movff	BSR_TEMP,BSR		;restore BSR register
		movff	WREG_TEMP,WREG		;restore working register
		movff	STATUS_TEMP,STATUS	;restore STATUS register
		retfie

;******************************************************************************
;High priority interrupt routine
; The high priority interrupt code is placed here to avoid conflicting with
; the low priority interrupt vector.

HighInt:

;	*** high priority interrupt code goes here ***


		retfie	FAST

;******************************************************************************
;Start of main program
; The main program code is placed here.

Main:

;	*** main code goes here ***

	clrf	TRISA
	movlw	.20
	movwf	EXAMPLE
wait
	decfsz	TEMP
	bra		wait
	decfsz	TEMP2
	bra		wait
	decfsz	EXAMPLE
	bra		wait
	movlw	.20
	movwf	EXAMPLE
	btg		LATA, RA0, A	; Flash that LED!!!
	bra		wait


;******************************************************************************
;End of program

		END
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top