Sari la conținut
ELFORUM - Forumul electronistilor

cum se pot realiza timere cu pic?


ovy_pas

Postări Recomandate

  • Răspunsuri 76
  • Creat
  • Ultimul Răspuns

Top autori în acest subiect

  • ovy_pas

    31

  • Liviu M

    24

  • Elef

    11

  • Eugen_B

    4

Top autori în acest subiect

Citat din manualul Hi-Tech picc:

3.4.6.2 VOLATILE TYPE QUALIFIERThe volatile type qualifier is used to tell the compiler that an object cannot be guaranteedto retain its value between successive accesses. This prevents the optimizerfrom eliminating apparently redundant references to objects declared volatilebecause it may alter the behavior of the program to do so.Any SFR which can be modified by hardware or which drives hardware is qualified asvolatile, and any variables which may be modified by interrupt routines should usethis qualifier as well. For example:volatile static unsigned int TACTL @ 0x160;The volatile qualifier does not guarantee that any access will be atomic, which isoften not the case with the PIC10/12/16 architecture, which can only access a maximumof 1 byte of data per instruction.The code produced by the compiler to access volatile objects may be different tothat to access ordinary variables, and typically the code will be longer and slower forvolatile objects, so only use this qualifier if it is necessary. However failure to usethis qualifier when it is required may lead to code failure.Another use of the volatile keyword is to prevent variables being removed if theyare not used in the C source. If a non-volatile variable is never used, or used in away that has no effect on the program’s function, then it may be removed before codeis generated by the compiler.A C statement that consists only of a volatile variable’s name will produce code thatreads the variable’s memory location and discards the result. For example the entirestatement:PORTB;will produce assembly code the reads PORTB, but does nothing with this value. This isuseful for some peripheral registers that require reading to reset the state of interruptflags. Normally such a statement is not encoded as it has no effect.Some variables are treated as being volatile even though they may not be qualifiedin the source code. See Section 3.13.4.2 “Undefined Symbols” if you have assemblycode in your project.

Link spre comentariu

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 cont

Autentificare

Ai deja un cont? Autentifică-te aici.

Autentifică-te acum



×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui.Termeni de Utilizare si Ghidări