- Akku Tests und Balkonkraftwerk Speicher         
Ergebnis 1 bis 2 von 2

Thema: hex-zahl konvertieren? geht um int0 rising bei bascom

  1. #1
    Erfahrener Benutzer Fleißiges Mitglied
    Registriert seit
    30.03.2004
    Beiträge
    137

    hex-zahl konvertieren? geht um int0 rising bei bascom

    Anzeige

    LiFePo4 Akku selber bauen - Video
    Hallo,

    Der Bascom Compiler hat ja einen bug, der verhindert beim atmega32 den int0 als zB. rising zu compilen.
    folgendes hatte ich gefunden:

    Code:
    The upshot is:
    There IS a compiler error. It states that INTO - INT2  only trigger on low
    level.
    There is also, I believe, a related error in the simulator that keeps M8,
    M16, M32, & M64 from responding to INT0 but allows the other Megas to act
    properly.
    
    Workaround?  YES, for the compiler... and it's simple.
    In the MCUCR (Recognized by Bascom so you can talk to it)
    Bits .0 and .1 control INT0
    Bits .2 and .3 control INT1
    The Bit patterns to set up either Interrupt are:
        00    Low Level
        01    Any Change*      (A NICE Feature not yet addressed by Bascom)
        10    Falling Edge
        11    Rising Edge
    (Each bit has its own name, but these names weren't known to Bascom,)
    Simpler code is possible and assembler would be more compact, but the
    following code does it:
    
    ' To Configure  INT0 = FALLING and conserve MCUCR
    MCUCR = MCUCR AND &HFC               'Mask off Bits .0 and .1
    MCUCR = MCUCR    OR &H02                ' "Fallimg" bit pattern
    
    That's all there is. Move two bits to the left for INT1.
    DISCLAIMER:
    I tested this in the simulator only, not on hardware. It works fine on all
    but the mega's listed above. I ASSUME that a simulator error  prevents
    proper INT action in the simulator and that the workaround will make the
    hardware respond properly. I'd appreciate hearing if it does.
    
    P.S.
    Its amazing what these data sheets can tell you.
    
    JWC
    
    *On most or all of newer AVRs.
    
    
    
    
    
    Good thinking !  I must admit that when I think of setting registers and
    ports, I automatically fall into ASM mode, forgetting that you can do that
    in Bascom as well.  Bascom at least hasnt gone the way of the PC world,
    where you are totally disconnected from the hardware.
    
    Regards,
    
    Adrian Jansen     adrianjansen@internode.on.net
    J & K MicroSystems
    Microcomputer solutions for industrial control
    MCUCR = MCUCR AND &HFC 'Mask off Bits .0 and .1
    MCUCR = MCUCR OR &H02

    heißt also auf deutsch config int0 = falling... Wie mache ich laut der oben genannten hex-schreibweise aus dem falling ein rising? und aus dem int0 ein int1?

    Über schnelle Hilfe wäre ich dankbar...

    Gruss

    Jan[/code]

  2. #2
    Erfahrener Benutzer Fleißiges Mitglied
    Registriert seit
    08.08.2004
    Ort
    durmersheim international
    Alter
    64
    Beiträge
    159
    hi,
    was die oberen bits nu für 'ne aufgabe haben weiss ich gerade nicht.
    ich schreib das ganze immer binär, also MCUCR=&B11111100
    die hinteren 2 nullen erzählen dem avr, dass into bei low getriggert werden soll.
    die 3. und 4. stelle von hinten handlen den int1, also würde die o.g. anweisung den int1 bei rising edge triggern, steht im datenblatt auf s.64 beschrieben. ob an den 1. 4 ziffern was 'geschraubt' werden muss, bleibt noch rauszufinden.
    gruss und fröhliches knobeln noch, harry

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

12V Akku bauen