![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #16 |
|
Oh, forgot, as well you have a brace too many. Here is your code rearanged so it's more readable for me, Code: #include <system.h>
// _LVP_OFF disables Low Voltage Programming, enabling use of the RB3 output.
#pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC & _LVP_OFF
#pragma CLOCK_FREQ 20000000
#define a porta.0 // Define porta.0,1.2 as variable a,b,c
#define b porta.1 // These will be used as the input variables
#define c porta.2
void main(void)
{
char i; // introduce I as a variable for the flash
// - turn portb inputs that we are using into digital mode.
adcon1 = 0b00000110; //digital
trisb = 0x00; //Output
trisc = 0x00; // Output
trisa = 0xFF; // Turn Porta A as an Input
while( 1 )
{
for(i=0;i!=0;i<<=1){
portb = i;
delay_ms( 50 );
}
portb = 0;
delay_ms( 15 );
if(a){
for(i=0;i!=0;i>>=1) {
portb = i;
delay_ms ( 50 );
}
portb = 0;
delay_ms ( 50 );
}
}
}
| |
| |
| | #17 |
|
Mike, I have to thank you. You have taught me very valuable stuff. I managed to do it myself before seeing your last post. I opened up the BoostC manual, and decided to use the "?" conditional for the first time, and it worked.
| |
| |
|
| Tags |
| boostc |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| BoostC Charlieplexed PWM 32 | Mike, K8LH | Micro Controllers | 140 | 27th March 2009 11:19 AM |
| Hardware SPI with BoostC weirdness | futz | Micro Controllers | 0 | 23rd July 2008 06:57 AM |
| BoostC Flaw? | AtomSoft | Micro Controllers | 7 | 19th July 2008 04:32 AM |
| BoostC USART 18F | AtomSoft | Micro Controllers | 9 | 29th June 2008 05:02 PM |
| math.h and lib for BoostC? | futz | Micro Controllers | 3 | 31st March 2008 06:29 AM |