Squirrels have fuzzy tails.
0 Members and 1 Guest are viewing this topic.
install giveio.bat found in winavr/bin
#include <avr/io.h>// Last modified: 26 October 2006// Changed to work with WinAVR 20060421// modified: 21 April 2005// Compiled on WinAVR 20060421//---------------------// function prototypesvoid delay(void);int main(void);//---------------------void delay(void){unsigned long int waitcounter; waitcounter = 100000; while(waitcounter != 0) { waitcounter--; } }int main(void){//---------// initialise the hardware DDRD=0x01;//---------// initialise the count value //---------// the main loop while(1) {// the delay delay();// the port counting PORTD ^=(1<<0)l; }//---------}
// the port counting PORTD ^=(1<<0)l;this is a much simpler code this will work on pin 0 of port d , switching it on and off at regular intervals
first of all your code is quite wrong while(0 != waitcounter)...no no nothis is not the format , its not plain english your talking , its a programming language write like thiswhile(waitcounter != 0)
another thing portc=countval++ what do u mean by that, its not a normal variable you are accessing , its a register write it in binary or hex form
another thing portc=countval++ what do u mean by that, its not a normal variable you are accessing , its a register write it in binary or hex formThis code should still work though
void configure_ports(void){ DDRC = 0x00; //configure all C ports for input PORTC = 0x00; //make sure pull-up resistors are turned off DDRD = 0xFF; //configure all D ports for output DDRB = 0xC7; //configure B ports 0, 1, 2, 6, 7 for output, 11000111}
it would go on without stopping like start count val from 0 then1 then 2 then so on... dont u realise that?
uint_8 countval =0;DDRC = 0xff; // set portc to outputwhile(1){ PORTC = countval++; wait for 1 second}