Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Recent content by blackcsc

  1. B

    Need help on I/O for Atmega48 C coding

    Thanks Alex ;) Appreciate on your help.. I'll try to figure out, any problem i'll come back and seek help from you all, but 1 more thing, i was told that my pwm calculation was incorrect.. can anyone help me out ? Or should i open another post for pwm ? Let say below are my settings.. 8Mhz...
  2. B

    Need help on I/O for Atmega48 C coding

    hey alexxx, THANK !!! the code should be : if ((PIND & 0x07)==3) //if D0=D1=1 { OCR1A = 1520; } else //D0 or D1 or D2 both are low { OCR1A = 0; } remember that my condition include D2 ? D0 & D1 = 1 then it turns, if D0, D1 & D2 = 1 then it turns also.. If i use PIND & 0x03 then my D2...
  3. B

    Need help on I/O for Atmega48 C coding

    actually my control should b on D1 instead of D2.. but & is the meaning of AND right ? When i simulated it, either D0 D1 = 1 it will turns.. i tried the code below but the motor do not response again.. WHY !!! haix if (PIND == 0x03) { OCR1A = 1520; } else { OCR1A = 0; }
  4. B

    Need help on I/O for Atmega48 C coding

    Hi Alexxx, is it necessary for the pull up ?? I find it weird when i pull out the D1 from GND to 5v, the motor turns, same goes to D2.. Can i just put it this way ?? i only focus on pin D2 like what you had suggested, but instead of GND it to turn the motor, i want it to be HIGH then it'll turn...
  5. B

    Need help on I/O for Atmega48 C coding

    u mean using back the same pull up at PD2 |= 0x04 and replace the if else condition with my cases ?
  6. B

    Need help on I/O for Atmega48 C coding

    Thanks for the detailed steps on debugging :) Actually i need D2, D1 and D0 to control the motor, when D0 & D1 is "1", then motor spin and when D0, D1 and D2 is "1" then i turn back to 0.. That is why i need the case to be 0x03 and 0x07 in PortD to set the condition.. Can this rule applied to...
  7. B

    Need help on I/O for Atmega48 C coding

    how do i use the debug with the hardware @@ I thought debug is only for programming in avr studio ? I dont know which breakpoint is hit.. I taken out the pull up resistors command because i wan D2 = 1 to spin.. i also dont understand how come my mcu so weird, just to make the motor turns with...
  8. B

    Need help on I/O for Atmega48 C coding

    I'd ignored the pull up, so when i tested on the hardware, this is what i get now, when D1 is pull out from GND, the motor turns, then i put it to 5v, motor remains, when i pull D2 from GND to 5v also the same.. Is that suppose to be like that ? Because of this : volatile unsigned char _PIND...
  9. B

    Need help on I/O for Atmega48 C coding

    Hi alexxx, u mean the debugger for the hardware ? Or just the AVR studio debugger ? Or the simulation debugger ? When i try the code in AVR debugger, it keeps hitting default case, that's why the condition cant achieve.. I tried to disable all input but yet still hitting default when running...
  10. B

    Need help on I/O for Atmega48 C coding

    Which mean now my input should be 0 to run the motor and 1 will not have output ? Programmer or debugger ? I'm using AVR Studio and programmer is AVR MKII.. Yes, i can run step by step in debugging mode..
  11. B

    Need help on I/O for Atmega48 C coding

    Hi Alex, earlier on i was testing on (_PIND) but i couldnt get it, so the code i copied is actually i changed it back to PIND and goes without the PORTD & 0x07.. And i also tried to place the PORTD |=0x07 before the while loop but the motor keep turning even without input from PIND, and from...
  12. B

    Need help on I/O for Atmega48 C coding

    Thanks alot Alexxx, i tried with your suggestion but still no luck, should i declare the pull up before while loop on inside while loop ? I couldnt get any response either after adding those codes and giving the clear 1 and 0.. #include <avr/io.h> #include <util/delay.h> int main(void) { DDRB...
  13. B

    Need help on I/O for Atmega48 C coding

    I'm trying it on breadboard.. sadly after adding the edited codes, now the motor turns w/o meeting the condition that case 0x03 / 0x07... meaning, no input but the motor turns.. any idea what had caused it so ??
  14. B

    Need help on I/O for Atmega48 C coding

    thanks Alex, i left out the ICR1 when copy the code @@ I did have that but i still cant get the motor working when i burned it onto my mcu.. That's why i'm curious why the code doesn't work.. I checked through some other sample codings, it should be working @@ 1 more thing, if i test it on...
  15. B

    Need help on I/O for Atmega48 C coding

    DDRB |= (1<<PB1); TCCR1A|=(1<<COM1A1)|(1<<COM1B1)|(1<<WGM11); TCCR1B|=(1<<WGM13)|(1<<WGM12)|(1<<CS11); DDRD = 0x00; while(1) { switch (PIND) { case (0x03): { OCR1A = 1520; break; } case (0x07): { OCR1A = 0; break; } default:break; } } return 0; } above is...

Part and Inventory Search

Back
Top