Jump to content
ELFORUM - Forumul electronistilor

nu stiu ce are PIC -ul meu


Recommended Posts

Am cumparat un PIC16f871, am facut un programmer, am legat un afisaj cu 3 cifre (7 segmente si punct) la porturile E0-2 comanda afisaj si A2-5 + C0-3 comanda led ... am scris cod in ASM ... l-am programat, totul bine... dar cand il pun in soclul aplicatiei nu face nimic, decat trece E0-3 in 4.58V, A2-5 si C0-3 in 0.04V, iar restul 0 V . ... Am tot incercat si de cateva ori s-au aprins ledurile dar cand am apasat pe RESET(MCLR\) sau daca l-am repornit din nou am patit la fel (E-4.58V, etc.).

Link to comment
  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Am cumparat un PIC16f871, am facut un programmer,

 

ar trebui verificat ca programatorul iti merge...

 

am legat un afisaj cu 3 cifre (7 segmente si punct) la porturile E0-2 comanda afisaj si A2-5 + C0-3 comanda led ... am scris cod in ASM ... l-am programat, totul bine...

 

programeaza intai ceva simplu, de exemplu sa palpaie punctul, apoi programeaza ceva mai complicat de exemplu un sarpe umblator pe segmente...

 

dar cand il pun in soclul aplicatiei nu face nimic, decat trece E0-3 in 4.58V, A2-5 si C0-3 in 0.04V, iar restul 0 V . ... Am tot incercat si de cateva ori s-au aprins ledurile dar cand am apasat pe RESET(MCLR\) sau daca l-am repornit din nou am patit la fel (E-4.58V, etc.).

 

MCLR conectat la GND prin 100nF cu rezistenta de pullpup de 10K la VCC

Convertorul AD trebuie dezactivat daca umbli cu semnale digitale pe portul A, fuzibilele programate OK ?, oscilatorul de 4Mhz sau altul cu capacitoare de 15-33pF la masa, in apropierea cipului si nu la kilometri distanta de el... Nu utiliza soclu ci ICSP alfel faci bataturi la surubelnita pana o sa-l programezi... etc

 

Link to comment

Discutia fara o schema este inutila. In plus de unde stii ca ai scris in PIC un cod fara erori?

Cu întârziere, dar iată schema (e ataşată la post)

ar trebui verificat ca programatorul iti merge . . .programeaza intai ceva simplu, de exemplu sa palpaie punctul, apoi programeaza ceva mai complicat de exemplu un sarpe umblator pe segmente . . . MCLR conectat la GND prin 100nF cu rezistenta de pullpup de 10K la VCCConvertorul AD trebuie dezactivat daca umbli cu semnale digitale pe portul A, fuzibilele programate OK ?, oscilatorul de 4Mhz sau altul cu capacitoare de 15-33pF la masa, in apropierea cipului si nu la kilometri distanta de el... Nu utiliza soclu ci ICSP alfel faci bataturi la surubelnita pana o sa-l programezi... etc

Programatorul îmi identifică PIC-ul, deci cred că este bun, nu?Eu deocamdată încerc să programez ceva şi mai simplu, să-mi facă OUT pe portul C şi nu reuşesc.Cuarţul e la 1 cm de PIC cu 4 condensatoare în serie + paralel (2 x (12 pF + 2.7 pF)). Atunci o să încerc să fac ICSP.
Link to comment
;**********************************************************************; This file is a basic code template for object module code *; generation on the PIC16F871. This file contains the *; basic code building blocks to build upon. As a project minimum *; the 16F871.lkr file will also be required for this file to *; correctly build. The .lkr files are located in the MPLAB *; directory. *; *; If interrupts are not used all code presented between the *; code section "INT_VECTOR and code section "MAIN" can be removed. *; In addition the variable assignments for 'w_temp' and *; 'status_temp' can be removed. *; *; If interrupts are used, as in this template file, the 16F871.lkr *; file will need to be modified as follows: Remove the lines *; CODEPAGE NAME=vectors START=0x0 END=0x4 PROTECTED *; and *; SECTION NAME=STARTUP ROM=vectors *; and change the start address of the page0 section from 0x5 to 0x0 **; *; Refer to the MPASM User's Guide for additional information on *; features of the assembler and linker (Document DS33014). *; *; Refer to the respective PIC data sheet for additional *; information on the instruction set. *; *;**********************************************************************; *; Filename: xxx.asm *; Date: *; File Version: *; *; Author: *; Company: *; *; *;**********************************************************************; *; Files required: *; *; *; *;**********************************************************************; *; Notes: *; *; *; *; *;**********************************************************************list p=16f871 ; list directive to define processor#include <p16f871.inc> ; processor specific variable definitions__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _RC_OSC & _WRT_ENABLE_ON& _LVP_ON & _CPD_OFF; '__CONFIG' directive is used to embed configuration data within .asm file.; The labels following the directive are located in the respective .inc file.; See respective data sheet for additional information on configuration word.;***** VARIABLE DEFINITIONS (examples); example of using Shared Uninitialized Data SectionINT_VAR UDATA_SHR 0x71w_temp RES 1 ; variable used for context savingstatus_temp RES 1 ; variable used for context saving; example of using Uninitialized Data SectionTEMP_VAR UDATA_SHR 0x20 ; explicit address specified is not requiredtemp_count RES 1 ; temporary variable (example);**********************************************************************RESET_VECTOR CODE 0x000 ; processor reset vectormovlw high start ; load upper byte of 'start' labelmovwf PCLATH ; initialize PCLATH; org 0 ;setarea startuluigoto start ; go to beginning of programINT_VECTOR CODE 0x004 ; interrupt vector locationmovwf w_temp ; save off current W register contentsmovf STATUS,w ; move status register into W registermovwf status_temp ; save off contents of STATUS register; isr code can go here or be located as a call subroutine elsewheremovf status_temp,w ; retrieve copy of STATUS registermovwf STATUS ; restore pre-isr STATUS register contentsswapf w_temp,fswapf w_temp,w ; restore pre-isr W register contentsretfie ; return from interruptbank0 macrobcf STATUS, RP0bcf STATUS, RP1 ;BANK 0endmbank1 macrobsf STATUS, RP0bcf STATUS, RP1 ;BANK 0endmMAIN CODEstartbank0CLRF PORTACLRF PORTCCLRF PORTE;loopbank1 ;BANK 1clrwmovwf TRISC ; configure PORTC as all outputsMOVLW 0XC0movwf TRISA ;configure PORTA as all outputsmovwf TRISE ; configure PORTE as all outputsmovlw 0x07movwf ADCON1 ; configure the function of the analog-to-digital; converter as all Digital I/Oloopbank0 ;BANK 0MOVLW 0x06MOVWF PORTEMOVLW b'00111100'MOVWF PORTAMOVLW 0XfeMOVWF PORTCgoto loop; remaining code goes hereEND ; directive 'end of program'
Link to comment

Pai, de ce _RC_OSC (declaratie in __CONFIG), cand tu ai configuratie _XT_OSC (pe schema)?

eu nu am scris cod decat de la bank0 macro

in jos ... s-ar putea sa fiu asta problema.

Am verificat schema -- firul DATA (ICSP) nu facea contact bine, acuma i-mi recunoaste PIC-ul programatorul

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.Terms of Use si Guidelines