Hi
Did someone know if I can weakup the Mikrocontroller 18F452 with USART RX too or just with PORTB Interrupts.
I Use @Sleep and all work fine with PortB Change Interrupt.
Thank You for any Answer.
Regards Pesti
Hi
Did someone know if I can weakup the Mikrocontroller 18F452 with USART RX too or just with PORTB Interrupts.
I Use @Sleep and all work fine with PortB Change Interrupt.
Thank You for any Answer.
Regards Pesti
yes - see section 19.3 of the datasheet
you can have the PIC continue on with the instruction after the @ sleep or vector to your ISR ... depending on your interrupt settings
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi
Thanks Yes I found on the Datasheet this.
8. USART RX or TX (Synchronous Slave mode).
But I need Asynchronous!
I think that I can not without Shematic change I must to use a resistor or a transistor from RX to PortB.4 ,when I receive something I must Change the State for PortB.4.
Regards Pesti
I did not understand your question before (and still do not know what you are trying to do or what your TX source is?). During Sleep, the BRG is inactive (the clock to USART is suspended) so you cannot wakeup and catch incoming data automatically.
A couple options to consider:
1)You could tie your RX pin to one of the PORTB “wake on change” pins as you suggest, but it sounds like this is a board change for you. Doing this, you can wakeup your PIC with a toggle of the line into your RX pin and then be ready to catch data. Obviously, you would need to be able to toggle the line from the source – is this an option?
2)You could switch to the almost identical 18F4520. This PIC for the most part is PIN for PIN compatible, but has some neat advanced power management modes that enable the clock to the EUSART to be on when in reduced power mode. It also has an Auto-Wake-Up from Sleep feature that works essentially the same as option 1, except it all happens on the RX pin.
One last note - the 18F4520 is more feature rich and costs about 30% less than the 18F452.
Good Luck
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Hi
I think that my Weakup is Workinng but it s not!
I use this code the Device go Sleep I measure the mA Normal Mode with Display without Backlight is 12 mA and Sleep is ~6.6 mA.
I reduce my Code to Minimum ,This is my Code:
INCLUDE "modedefs.bas"
DEFINE OSC 20
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 6
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 4
DEFINE LCD_BITS 4
RCON = %00000000 'Enable priority levels on interrupts
ADCON0 = %11000000 'Configure and turn off A/D Module.
ADCON1 = %01000110 'configuriere alle 8 digitale Kanäle werden aktiviert
RCIF VAR PIR1.5 ' Alias RCIF (USART Receive Interrupt Flag)
OERR VAR RCSTA.1 ' Alias OERR (USART Overrun Error Flag)
CREN VAR RCSTA.4 ' Alias CREN (USART Continuous Receive Enable)
ADON VAR ADCON0.2 'A/D On bit
RCIE VAR PIE1.5 'USART Receive Interrupt Enable bit
RCIE = 0 ' enable USART RX interrupts
'''''''''''''''''''''''''''''''''''Interrupts '''''''''''''''''''''''''''''''''''''''''''''''
RBIF VAR INTCON.0 'RB Port Change Interrupt Flag bit
RBIE VAR INTCON.3 'RB Port Change Interrupt Enable bit
RBPU VAR INTCON2.7 'PORTB Pull-up Enable bit
PEIE VAR INTCON.6 'Peripheral Interrupt Enable bit
INT1IF VAR INTCON3.0 'INT1 External Interrupt Flag bit
INT2IF VAR INTCON3.1 'INT2 External Interrupt Flag bit
INT1IE VAR INTCON3.3 'INT1 External Interrupt Enable bit
INT2IE VAR INTCON3.4 'INT2 External Interrupt Enable bit
RBIE = 0 'Disables the RB port change interrupt
RBPU = 0 'PORTB pull-ups are enabled by individual port latch values
TMR0IF VAR INTCON.2 'TMR0 Overflow Interrupt Flag bit
TMR0IE VAR INTCON.5 'TMR0 Overflow Interrupt Enable bit
T0PS0 VAR T0CON.0 'Timer0 Prescaler Select bits
T0PS1 VAR T0CON.1 'Timer0 Prescaler Select bits
T0PS2 VAR T0CON.2 'Timer0 Prescaler Select bits
T0CS VAR T0CON.5 'Timer0 Clock Source Select bit
T08BIT VAR T0CON.6 'Timer0 8-bit/16-bit Control bit
TMR0ON VAR T0CON.7 'Timer0 On/Off Control bit
PSA VAR T0CON.3 'Timer0 Prescaler Assignment bit
TMR0IP VAR INTCON2.2 'TMR0 Overflow Interrupt Priority bit
TMR0IE = 0 ' TMR0 Overflow Interrupt Enable bit
TMR0ON = 0 ' Timer0 On/Off Control bit
T08BIT = 0 ' Timer0 8-bit/16-bit Control bit
T0CS = 0 ' Timer0 Clock Source Select bit
T0PS0 = 1 ' Timer0 Prescaler Select bits
T0PS1 = 0 ' Timer0 Prescaler Select bits
T0PS2 = 0 ' Timer0 Prescaler Select bits
PSA = 0 ' Timer0 Prescaler Assignment bit
TMR0IF = 0 ' TMR0 Overflow Interrupt Flag bit
TMR0IP = 1 ' TMR0 Overflow Interrupt Priority bit
TMR0H = $3C
TMR0L = $AF
INT0IF var INTCON.1 'INT0 External Interrupt Flag bit
INT0IE var INTCON.4 'INT0 External Interrupt Enable bit
INTEDG0 var INTCON2.6 'External Interrupt0 Edge Select bit
INT0IE = 1 'Disable INT0 interrupt
PEIE = 0 ' enable Peripheral interrupts
INTEDG0 = 0 'Interrupt on falling edge
INT0IF = 0
TRISA.4 = 0
TRISB.0 = 1
TRISB.3 = 1
TRISB.4 = 1
TRISD.0 = 0
TRISD.2 = 0
TRISD.3 = 0
TRISD.7 = 0
Symbol Buzzer = PortC.1
Symbol LCD_Light = PortD.7
Symbol RW = PortD.5
Symbol WC = PortD.3 'EEprom Enable Bit
Mode var byte
Mode = 0
Low Sleep_Switch
Pause 5
High LCD_Light
Low WC
Pause 100
Low RW
Pause 500
Lcdout $fe, 1 ' Clear screen
Pause 1
Lcdout $FE, $80, " RFID "
Lcdout $FE, $C0, " Software V.1.0 "
Pause 2000
Low LCD_Light
Lcdout $FE,1
Pause 10
On Interrupt Goto IntHandler
Timer:
Lcdout $fe,$80,"Standby"
Pause 100
Goto Timer
Disable
IntHandler:
Lcdout $FE,1
Pause 10
IF (INT0IF and INT0IE) then Goto Push_Button
Resume
Push_Button:
Sound Buzzer,[123,5]
'Debounce
Pause 250
INT0IF = 0 ' INT0 External Interrupt Flag bit Reset
Goto Button_Sel_Mode
Button_Sel_Mode:
If Mode = 0 Then
Mode = 1
Low LCD_Light
Lcdout $fe,$80,"Status 1"
Pause 100
INT0IF = 0
@Sleep
Endif
If Mode = 1 Then
High LCD_Light
Mode = 0
Lcdout $fe,$80,"Status 2"
Pause 1000
Endif
Resume
Enable
End
Thank You for any Help
Regards Pesti
Hi
I found the Problem I use now instead Falling edge Rising edge and now is weaking up the mcu.
but i dont know why work this just with Rising Edge!?
regards Pesti
Ok the Problem :-) was :PORTB pull-ups are enabled by individual port latch values
I use now the Interrupts without this setting and just with really Pullups resistor and now is all Working fine with my weakup.
Regards Pesti
Bookmarks