bogdanovich Postat Ianuarie 21, 2006 Partajează Postat Ianuarie 21, 2006 salutare. Am si eu o problema mare, ptr mine si v-ash ruga daca vreti sa ma ajutati. Lucrez in C, cu un pic 16F877A, folosesc ultima varianta demo de compilator de la microchip (picclite versiunea 9.50) si mplab7.30. Problema este ca am cam terminat memoria ram de pe primul bank de memorie, iar compilatorul imi da eroare. Am intrebat un prieten de-al meu si mi-a spus ca e de vina compilatorul, ca e o varianta demo, ca de fapt ar fi trebuit sa faca el singur trecerea pe al doilea bank atunci cand se termina primul, si ca, in acest caz nu prea am ce-i face. V-ash intreba daca nu cumva exista vreo instructiune in C prin care sa-i spun eu de la ce adresa incolo, sa-mi scrie variabilele. Proiectul meu are 4 fisire C, si numai bine ar fi daca asha putea sa-i spun ca toate variabile pe care le declar intr-un anumit fisier sa le scriu separat , fiecare intr-un bank de mem.merci anticipat Link spre comentariu
sifor Postat Ianuarie 21, 2006 Partajează Postat Ianuarie 21, 2006 Prietenul tau are dreptate. Versiunea demo a compilatorului e de vina.Versiunea full nu face asa ceva.Don Mario Link spre comentariu
bogdanovich Postat Ianuarie 21, 2006 Autor Partajează Postat Ianuarie 21, 2006 merci. Is mai bune variantele astea demo ca te invatza programare. Nimic nu e mai placut decat sa stai si sa optimisezi cod. Am glumit, cred ca e mai bine la o bere cu baietii. Acuma inca ceva: Liniile de date ale unui lcd se pot lega direct la pinii unui mic? Eu am pus initial lcd-ul pe portul B, in documentatie am citit ca toate liniile au rez de pull-up, insa cand scriam un 0 peste tot, nu toate liniile erau trase in 0. Ash vrea sa-mi datzi o explicatie va rog, desi am rezolvat problema pentru ca am pus lcd-ul pe alt port (portul A) si n-am mai avut astfel de probleme. mercibafta. Link spre comentariu
Cristiano Postat Ianuarie 22, 2006 Partajează Postat Ianuarie 22, 2006 ... 16F877A 2 RAM banks, 2K program memory supported The bank1, bank2 and bank3 type qualifiers are used to place static variables in RAM Bank 1, RAM Bank 2 and RAM Bank 3 respectively. In the baseline microprocessors, pointers are unaffected by these type qualifiers. Note that there is no bank0 qualifier. Objects default to being in bank 0 RAM if no other bank qualifier is used. All auto objects are positioned into bank 0 RAM, along with function parameters. Here is an unsigned char in bank 3 RAM: static bank3 unsigned char fred; Here is a pointer to an unsigned char in bank 3 RAM: bank3 unsigned char * ptrfred; Here is another pointer to an unsigned char in bank 3 RAM, except this time the pointer resides in bank 2 RAM: static bank 3 unsigned char * bank2 ptrfred; A global or static variable can be located at an absolute address by following its declaration with the construct @ address, for example: volatile unsigned charPortvar @ 0x06; will declare a variable called Portvar located at 06h. Note that the compiler does not reserve any storage, but merely equates the variable to that address, the compiler-generated assembler will include a line of the form: _Portvar EQU 06h Note also that the compiler and linker do not make any checks for overlap of absolute variables with other variables of any kind, so it is entirely the programmer?s responsibility to ensure that absolute variables are allocated only in memory not in use for other purposes. This construct is primarily intended for equating the address of a C identifier with a microprocessor register. To place a user-defined variable at an absolute address, define it in a separate psect and instruct the linker to place this psect at the required address. See ?The #pragma psect Directive? on page 174. Absolute variables have their address supplied by the code generator, not the linker, and hence no symbols are used which require fixup by the linker. This means that the name of the object will not be present in the map file, or any symbol information produced by the linker. [...] The bit variable facility may be combined with absolute variable declarations (see page 153) to access bits at specific addresses. Absolute bit objects are numbered from 0 (the least significant bit of the first Features and Runtime Environment 142 5 byte) up. Therefore, bit number 3 (the fourth bit in the byte since numbering starts with 0) in byte number 5 is actually absolute bit number 43 (that is 8bits/byte * 5 bytes + 3 bits). For example, to access the power down detection flag bit in the RCON register, declare RCON to be a C object at absolute address 03h, then declare a bit variable at absolute bit address 27: static unsigned char RCON @ 0xFD0; static near bit PD @ (unsigned)&RCON*8+2; Note that all standard registers and bits within these registers are defined in the header files provided. The only header file you need to include to have access to the PIC registers is - at compile time this will include the appropriate header for the selected chip. Link spre comentariu
bogdanovich Postat Ianuarie 22, 2006 Autor Partajează Postat Ianuarie 22, 2006 merci mult cristiano. Chiar asteptam raspunsul tau. Imi cer scuze daca am deranjat inainte sa caut prin manual, dar nu stiam ca exista asa ceva, mai clar nu stiam unde sa caut. M-am apucat de curand de pic-uri si se pare ca trebuia inainte sa fac rost de toata documentatia necesara. Bafta multa Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum