Forum: Mikrocontroller und Digitale Elektronik ATMeag48 PC6 + PC7 nutzen


von Andreas B. (andreasb)


Lesenswert?

Ich habe hier ein ATMega48 und möchte die Pins PC6 und PC7 als I/Os 
nutzen. Im Datenblatt steht (Int. RC Osc. fuse ist gesetzt):

TOSC1: Timer Oscillator pin 1. Used only if internal calibrated RC 
Oscillator is selected as chip clock source, and the asynchronous timer 
is enabled by the correct setting in ASSR. When the AS2 bit in ASSR is 
set (one) to enable asynchronous clocking of Timer/Counter2, pin PB6 is 
disconnected
from the port, and becomes the input of the inverting Oscillator 
amplifier. In this mode, a crystal Oscillator is connected to this pin, 
and the pin can not be used as an I/O pin.

Also dachte ich wenn ich ASSR &= ~ AS2; setzte habe ich das Bit gelöscht 
(0) und somit kann ich den Pin nutzen... Dem ist aber nicht so... Der 
Pin ist immer High.


der Code:
1
int main(void)
2
{
3
4
  
5
  ASSR &= ~ AS2;
6
  
7
  /* Setzt das Richtungsregister des Ports auf 0xff 
8
  (alle Pins als Ausgang): */
9
  DDRB = 0xff;
10
  PORTB = 0;
11
....

Pin 7 brauche ich nicht unbedingt, aber auch der ist immer auf High...


ich hoffe es kann mir jemand sagen was ich machen muss...
Danke.

mfg Andreas

von johnny.m (Gast)


Lesenswert?

> ASSR &= ~ AS2;
Wie wäre es mit
1
ASSR &= ~(1 << AS2);
?

von Andreas B. (andreasb)


Lesenswert?

Stimmt das war ein Fehler, aber leider funktioniert es immer noch 
nicht...
Der Pin ist und bleibt high.


mfg Andreas

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.