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.

PIC16F876A with C, don't run.

Status
Not open for further replies.

Riclamer

New Member
Hello freands...

I build a circuit with PIC16F876A, and i just what to power a led 3 colors (4 pin) in RB0, RB1, RB2.

My circuit is energized with a 9V batery and reguled to 5v with LM78L05. (pin 8 ) (pin 1 MCLR)

I have a external crystal 20MHz with capacitor ceramic 33pf (pin 9, 10 ).

My code is build with CCSC, ( language C ). I just what to power the led 1 (RB0) for x seconds and power off and power de other led (RB1) for x seconds, then power off and power on the last led (RB2). Very simple... but not run.

The problem is my code or my circuit ?

The Code:
__________
#FUSES NOWDT //Watch Dog Timer desabilitado
#FUSES HS //oscilador cristal <= 20mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //sem proteção para leitura da eprom
#FUSES BROWNOUT //Resetar quando detectar brownout
//#FUSES MCLR // error in Build
#FUSES NOLVP // prog. baixa voltagem desabilitado
#FUSES NOCPD //
#use delay(clock=20000000)
#use fast_io(a)
#use fast_io(b)
#define trisa 0b00000000 // 0 output, 1 input
#define trisb 0b00000111 // or #define trisb 0x00

void main()
{

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

// TODO: USER CODE!!
while(true)
{
output_high(PIN_B0);
output_low(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_high(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_low(PIN_B1);
output_high(PIN_B2);
delay_ms( 1000 );
};

}
 
Last edited:
A couple of things to realize before those leds light up. One, the PIC's multiplexed pins have an order of precedence on start up or reset, most notably the analog and comparator modules over the digital outputs. Two, when thinking about the TRISX port function making an output or input, think "0" for output, and think "1" for input. Refer to the data sheet for actual settings but it should go something like this:

Code:
#define TRISB = 0b00000000
#define ADCON0 = 0b00000000		'ADON off
#define ADCON1 = 0b00000110		'all digital
#define CMCON = 0b00000111
 
Tanks for you reply, Nickelflippr...

The precedence of analog and comparator i think are set on: "setup_comparator(NC_NC_NC_NC);"

The config of TRISX, are made in : "#define trisb 0b11111000 " in data sheet refer "0" to output and "1" to input... I was made the change in TRISB andwith your ADCON... but not run.

You bilieve the problem are is clock config ?

Actual Code:
___________
Code:
#INCLUDE <16F876A.h>        //INCLUSÃO DA BIBLIOTECA liblary
#FUSES NOWDT //Watch Dog Timer desabilitado
#FUSES HS //oscilador cristal <= 4mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //sem proteção para leitura da eprom
#FUSES BROWNOUT //Resetar quando detectar brownout
//#FUSES MCLR //Reset habilitado
#FUSES NOLVP // prog. baixa voltagem desabilitado
#FUSES NOCPD //
#use delay(clock=20000000)
#use fast_io(a)
#use fast_io(b)
#define TRISA 0b00000000 // 0 output, 1 input
#define TRISB 0b00000000 // ou #define trisb 0x00
#define ADCON0 = 0b00000000     //    'ADON off
#define ADCON1 = 0b00000110    //    'all digital
#define CMCON = 0b00000111

void main()
{

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

   // TODO: USER CODE!!
   while(true)
   {
output_low(PIN_B0);
output_high(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
output_low(PIN_B0);
output_low(PIN_B1);
output_high(PIN_B2);
delay_ms( 1000 );
output_high(PIN_B0);
output_low(PIN_B1);
output_low(PIN_B2);
delay_ms( 1000 );
};

}
 
Last edited by a moderator:
The MCLR could be in an undefined state, causing a constant reset, use a 10k resistor pullup to V+.

Install 0.1uf cap accross V+ and V- of the PIC chip.

As far as the clock is concerned, it is always suspect if nothing is working, bad crystal? Try another crystal if you have one and recheck crystal/caps wiring. If this is a proto board then visually inspect for solder bridges, and probe with meter.

Does the chip get hot? Last resort, change the PIC chip in case it was accidentally smoked with an over voltage condition. Do this only after double checking the 5V output of the LM7805. Are the input and output caps installed per data sheet?
 
I have the resistor 10K under MCLR. But don't the cap 0.1 uf..
The chip is not hot. The solder is good.

I will change de crystal and solder the cap 0.1uf.. After test i back with news.
 
Do you have to use SET_TRIS_x()? I tried to install the CCS demo, but it is not working for me. I found the SET_TRIS_x() in the 16F876A header file comments. If you use #define TRISA, etc does the CCS compiler know what to do with it or do you have to use it somewhere in your code?
 
I changed the Crystal and cap 0.01uf. I tested with multimeter, and under MCLR (pin1) are with 6,75v.
Look at second code, the include 16f876a.h is arready done.

I built the code, but not run...

Can you send me simple code in ASM ( MPLAB assemby ) to test output_high under "RB0" ?? Maybe the problem is the code...

Tanks
 
Do you have to use SET_TRIS_x()? I tried to install the CCS demo, but it is not working for me. I found the SET_TRIS_x() in the 16F876A header file comments. If you use #define TRISA, etc does the CCS compiler know what to do with it or do you have to use it somewhere in your code?

You will have to set it in code somewhere. defining it will just create a preprocessor variable named TRISA with the value you put next to it, but this line does not result in any code.
 
I'll write a test program in MikroC, and upload it here when it is finished. At the moment, this is what you have correct?

Code:
/* TEST LED Program for Riclamer
   Processor: 16F876A at 20 Mhz
   
   power a led 3 colors (4 pin) in RB0, RB1, RB2.
   
                  ---------
        !MCLR/Vpp |1    28| RB7/PGD
         RA0/AN0  |2    27| RB6/PGC
         RA1/AN1  |3    26| RB5
   RA2/AN2/VREF-  |4    25| RB4
   RA3/AN3/VREF+  |5    24| RB3/PGM
       RA4/T0CKI  |6    23| RB2     -----> 220 Ohm --> B LED -|
     RA5/AN4/!SS  |7    22| RB1     -----> 220 Ohm --> G LED -+-GND
             Vss  |8    21| RB0/INT -----> 220 Ohm --> R LED -|
      OSC1/CLKIN  |9    20| Vdd
      OSC2/CLKOUT |10   19| Vss
  RC0/T1OSO/T1CKI |11   18| RC7/RX/DT
   RC1/T1OSI/CCP2 |12   17| RC6/TX/CK
         RC2/CCP1 |13   16| RC5/SDO
      RC3/SCK/SCL |14   15| RC4/SDI/SDA
                  ---------
              


My circuit is energized with a 9V batery and reguled to 5v with LM78L05. (pin 8 ) (pin 1 MCLR)

I have a external crystal 20MHz with capacitor ceramic 33pf (pin 9, 10 ).

*/
 
Last edited:
Agree with others on using the #define with the TRISX registers not good, mybad. Use TRISA = 0, TRISB = 0? I don't use CCS.

Vdd is 5V correct ?

A simple set RB0 MPASM program compiled from GCBasic, not tested.

Code:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
 LIST p=16F876A, r=DEC
#include <P16F876A.inc>
 __CONFIG _HS_OSC & _WDT_OFF & _LVP_OFF

;********************************************************************************

;Vectors
	ORG	0
	goto	BASPROGRAMSTART
	ORG	4
	retfie

;********************************************************************************

;Start of program memory page 0
	ORG	5
BASPROGRAMSTART
;Call initialisation routines
	call	INITSYS
;Automatic pin direction setting
	banksel	TRISB
	bcf	TRISB,0

;Start of the main program
MAIN
	banksel	PORTB
	bsf	PORTB,0
	goto	MAIN
BASPROGRAMEND
	sleep
	goto	BASPROGRAMEND

;********************************************************************************

INITSYS
	bcf	ADCON0,ADON
	banksel	ADCON1
	bcf	ADCON1,ADFM
	bcf	ADCON1,PCFG3
	bsf	ADCON1,PCFG2
	bsf	ADCON1,PCFG1
	bcf	ADCON1,PCFG0
	movlw	7
	movwf	CMCON
	banksel	PORTA
	clrf	PORTA
 
Here is the MikroC Test program. I haven't tried, but it should work if you are sourcing your LED from the 16F876A. You should be sourcing the LED from RB0, RB1, and RB2 as per the diagram in the previous post. Anyway this program should blink a RGB LED on RB0, RB1, and RB2. In your original program, you had RB0, RB1, and RB2 as inputs which would be sinking the LED.
 

Attachments

  • Flash_LED.asm
    2.2 KB · Views: 140
  • Flash_LED.hex
    403 bytes · Views: 141
  • Flash_LED.c
    1.9 KB · Views: 170
Last edited:
I changed the Crystal and cap 0.01uf. I tested with multimeter, and under MCLR (pin1) are with 6,75v.
Look at second code, the include 16f876a.h is arready done.

I built the code, but not run...

Can you send me simple code in ASM ( MPLAB assemby ) to test output_high under "RB0" ?? Maybe the problem is the code...

Tanks

Isn't 6,75v a little high?
 
Maybe not, per the datasheet:

Voltage on any pin with respect to VSS (except VDD, MCLR. and RA4) ....................................... -0.3 V to (VDD + 0.3 V)
Voltage on VDD with respect to VSS ........................................................................................................... -0.3 to +7.5 V
Voltage on MCLR with respect to VSS (Note 2) ................................................................................................0 to +14 V
Voltage on RA4 with respect to Vss .................................................................................................................0 to +8.5 V
 
CCS TRIS Example

This was located in the help file 'COMMON QUESTIONS AND ANSWERS.' It shows how to map a variable to a port, but could be adapted for your use. The key things to take from this is the use of #byte PORTB = 6, and the set_tris_b() function. At this point, I don't think you need to worry about PORTA or PORTC until you are ready to use them. Just as long as you set the TRIS bits and initialize PORTB, you should be ok.

C:
#byte   PORTB  =   6   //Just an example, check the
#define ALL_OUT 0     //DATA sheet for the correct
#define ALL_IN  0xff  //address for your chip

main() {
   
    int i;
    set_tris_b(ALL_OUT);
    PORTB = 0;// Set all pins low

    for(i=0;i<=127;++i)   // Quickly count from 0 to 127
          PORTB=i;          // on the I/O port pin
     set_tris_b(ALL_IN);
      i = PORTB;              // i now contains the portb value.
}
 
Last edited:
Hi nickelflippr,

Your code is good. Power on my LED on RB0.

Now i need to now, whay my code in C, don't run.

Look here my code in assembly:
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=16F876A, r=DEC
#include <P16F876A.inc>
__CONFIG _HS_OSC & _WDT_OFF & _LVP_OFF
xtal=20;

;********************************************************************************

;Vectors
ORG 0
goto BASPROGRAMSTART
ORG 4
retfie

;********************************************************************************

;Start of program memory page 0
ORG 5
BASPROGRAMSTART
;Call initialisation routines
call INITSYS
;Automatic pin direction setting
banksel TRISB
bcf TRISB,0

;Start of the main program
MAIN
banksel PORTB
bsf PORTB,0
goto MAIN
BASPROGRAMEND
sleep
goto BASPROGRAMEND

;********************************************************************************

INITSYS
bcf ADCON0,ADON
banksel ADCON1
bcf ADCON1,ADFM
bcf ADCON1,PCFG3
bsf ADCON1,PCFG2
bsf ADCON1,PCFG1
bcf ADCON1,PCFG0
movlw 7
movwf CMCON
banksel PORTA
clrf PORTA

END;
 
Hi Rmain..

I tried to built your code... but it's fail..

Log Errors:
----------------------------------------------------------------------
Debug build of project `D:\Projetos\Estacionamento\RB0_Assembly\RB0.mcp' started.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol `__DEBUG' is defined.
Wed Aug 17 23:18:40 2011
----------------------------------------------------------------------
Make: The target "D:\Projetos\Estacionamento\RB0_Assembly\RB0.o" is out of date.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F876A "RB0.asm" /l"RB0.lst" /e"RB0.err" /o"RB0.o" /d__DEBUG=1
Warning[205] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 2 : Found directive in column 1. (LIST)
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 9 : Labels must be defined in a code or data section when making an object file
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 15 : Executable code and data must be defined in an appropriate section
Message[302] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 16 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 16 : Executable code and data must be defined in an appropriate section
Message[302] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 18 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 18 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 20 : Executable code and data must be defined in an appropriate section
Message[302] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 22 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 22 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 24 : Executable code and data must be defined in an appropriate section
Message[302] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 26 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 26 : Executable code and data must be defined in an appropriate section
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 28 : Labels must be defined in a code or data section when making an object file
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 30 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 32 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 33 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 33 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 34 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 35 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 35 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 36 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 37 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 37 : Executable code and data must be defined in an appropriate section
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 38 : Labels must be defined in a code or data section when making an object file
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 39 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 39 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 40 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 40 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 41 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 41 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 42 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 42 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 43 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 43 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 44 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 44 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 45 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 47 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 49 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 51 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 52 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 52 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 53 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 54 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 54 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 55 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 56 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 56 : Executable code and data must be defined in an appropriate section
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 57 : Labels must be defined in a code or data section when making an object file
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 58 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 58 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 59 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 59 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 60 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 60 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 61 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 61 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 62 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 62 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 63 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 63 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 64 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 66 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 68 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 70 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 71 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 71 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 72 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 73 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 73 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 74 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 75 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 75 : Executable code and data must be defined in an appropriate section
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 76 : Labels must be defined in a code or data section when making an object file
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 77 : Symbol not previously defined (R13)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 77 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 78 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 78 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 79 : Symbol not previously defined (R12)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 79 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 80 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 80 : Executable code and data must be defined in an appropriate section
Error[113] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 81 : Symbol not previously defined (R11)
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 81 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 82 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 82 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 83 : Executable code and data must be defined in an appropriate section
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 85 : Executable code and data must be defined in an appropriate section
Error[151] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 87 : Operand contains unresolvable labels or is too complex
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 87 : Executable code and data must be defined in an appropriate section
Error[150] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 89 : Labels must be defined in a code or data section when making an object file
Error[152] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 89 : Executable code and data must be defined in an appropriate section
Error[129] D:\PROJETOS\ESTACIONAMENTO\RB0_ASSEMBLY\RB0.ASM 91 : Expected (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `D:\Projetos\Estacionamento\RB0_Assembly\RB0.mcp' failed.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol `__DEBUG' is defined.
Wed Aug 17 23:18:43 2011
----------------------------------------------------------------------
BUILD FAILED
 
Rmain,
I understand, why i need set set "#byte PORTB = 6" .

Why i need the "for" to power the led in RB0 ? I tried the code assembly of the nickelflippr , and my led in RB0 is energized. This confirm that my circuit are good. And the problem is the C code.

Can you help me, to create a C code to energize my RB0, RB1 and RB2 ?

Tank very much.
 
Status
Not open for further replies.

Latest threads

Back
Top