nooobboy4321
Junior Member level 1
Hi there,
I have problems in configuring my MCU as Input and also Output in my simple project. My goal on my program is like example, when RA0 of PORTA is toggled, all PORTB will blink ON-OFF, if I toggle RB0 of PORTB, all PORTC will blink ON-OFF, and if I toggle RC0, all PORTD will blink ON-OFF, etc....
I have a little background of programming using Mikro C. So far I able to do a simple blinking LED on a Breadboard using PORTB and PORTD as Input/Output.
I use this simple codes in Mikro C Pro:
---------------------------------------------------------------------
---------------------------------------------------------------------------
My Question is how to use PORTA, PORTC and PORTE same as I use PORTB and PORTD as Digital Input/Output?
Thanks in advance.
I have problems in configuring my MCU as Input and also Output in my simple project. My goal on my program is like example, when RA0 of PORTA is toggled, all PORTB will blink ON-OFF, if I toggle RB0 of PORTB, all PORTC will blink ON-OFF, and if I toggle RC0, all PORTD will blink ON-OFF, etc....
I have a little background of programming using Mikro C. So far I able to do a simple blinking LED on a Breadboard using PORTB and PORTD as Input/Output.
I use this simple codes in Mikro C Pro:
---------------------------------------------------------------------
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 void_main() { TRISB = 0xFF; >> Set PORTB as Input TRISD = 0xFF; >> Set PORTD as Input do { if ( portb.f0 == 1 ) >> If RB0 is Toggled { TRISD = 0x00; >> Set PORTD as Output PORTD = 0xFF; >> Toggle On Delay_ms(500); PORTD = 0x00; >> Toggle OFF Delay_ms(500); } if ( portd.f0 == 1 ) >> If RD0 is Toggled { TRISB = 0x00; >> Set PORTB as Output PORTB = 0xFF; >> Toggle On Delay_ms(500); PORTB = 0x00; >> Toggle OFF Delay_ms(500); } }while(1); }
---------------------------------------------------------------------------
My Question is how to use PORTA, PORTC and PORTE same as I use PORTB and PORTD as Digital Input/Output?
Thanks in advance.
Last edited by a moderator: