Forum: Mikrocontroller und Digitale Elektronik Sleep Pic C++


von kurtz (Gast)


Lesenswert?

Hallo zusammen,

wie versetze ich den Pic in Schlaf und lasse Ihn wieder aufwachen alle x 
minuten oder per Interrupt. Vorallem wie schreibt man das C++ Programm 
dafür wenn ich sleep(); schreiben möchte und dann eine Routine 
aufgerufen wird welche die Assembler settings macht.

Vielen Dank

von Schoasch (Gast)


Lesenswert?

Mit welchem Compiler schreibst du denn dein Programm? WElchen PIC 
verwendest du?

mfg Schoasch

von kurtz (Gast)


Lesenswert?

c18

p81f4520

von Schoasch (Gast)


Lesenswert?

Hi

Hast du es schonmal mit:
1
Sleep();
probiert? (Betonung liegt auf die Grosschreibung ;-))

Ansonst wirf einen Blick in die Header, da findest du dann folgende 
Zeile:
1
#define Sleep()  {_asm sleep _endasm}

mfg Schoasch

PS.: Soweit ich weis ist der C18 kein C++ Compiler, oder irre ich mich 
da jetzt?!

von Schoasch (Gast)


Lesenswert?

Aja und zum aufwecken steht folgendes im Datenblatt:
*********
Entering the Sleep mode from any other mode does not
require a clock switch. This is because no clocks are
needed once the controller has entered Sleep. If the
WDT is selected, the INTRC source will continue to
operate. If the Timer1 oscillator is enabled, it will also
continue to run.
When a wake event occurs in Sleep mode (by interrupt,
Reset or WDT time-out), the device will not be clocked
until the clock source selected by the SCS1:SCS0 bits
becomes ready (see Figure 3-6), or it will be clocked
from the internal oscillator block if either the Two-
Speed Start-up or the Fail-Safe Clock Monitor are
enabled (see Section 23.0 “Special Features of the
CPU”). In either case, the OSTS bit is set when the
primary clock is providing the device clocks. The
IDLEN and SCS bits are not affected by the wake-up.
*****

von kurtz (Gast)


Lesenswert?

ah "s"leep();

hatte ich versucht

aber nicht "S"

mal sehen. THX

Wie lasse ich den Pic jetzt nach x minuten wieder aufwachen und vorallem 
wie schreibe ich den C++ code das er per Int aufgeweckt wird?

danke

von Willivonbienemaya .. (willivonbienemaya)


Lesenswert?

Vor allem ist das C, nicht C++ und
vor allem lies mal das posting über deiner Frage.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.