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.
Here I tried to set DDRB4 and PORTB4 to 1, so isn't it enough?
DDRB = (1<<DDB7)|(0<<DDB6)|(1<<DDB5)|(1<<DDB4);//SCK->Out MISO->In MOSI & SS -> Out
PORTB = (1<<PB4);//SS held high
Hi
I wrote some comments and I hope it is more apparent now
//Master Code for ATmega16
#define F_CPU 8000000UL
//--------------------Libraries--------------------
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <string.h>
#include "lcd1/lcd.h"...
Hi Everyone
In an AVR project, I wanted to transfer data between master and slave and meanwhile,show both transmitted and received data on two LCDs.
The Master micro works fine but for slave micro it doesn't show the received data on lcd and I can't really figure out why.
Here are my codes (The...
Hi again
It seems the problem was my compiler i was using Codevision but now I've switched to AtmelStudio 7 and the problem is solved
The only way that the timer counter 1 can work properly in CTC mode is setting WGM12 in TCCR1B
Here is my code:
#define F_CPU 8000000UL
#include <avr/io.h>...
Hi again
I don't know maybe I'm using wring datasheet anyway it is an arduino uno and as far as I know it has an atmega328p micro(on my micro it is written
ATMEGA328P U and i think it is atmega32pu).
I also checked ATMEGA328,ATMEGA328P,ATMEGA328PB,ATMEGA328PU and they all have WGM12 in TCCR1B
There are 2 problems:
1:As I said before,when i set WGM12 in TCCR1B nothing happens but when i set it in TCCR1A it works(although datasheet says it is in TCCR1B) and i can't figure it out
2:In codevision, for atmega328p i can't use full 16 bit reg OCR1A(in spite of mega16 and 32) and i have to...
Hi
I set WGM12 in TCCR1B but again nothing happens
Also I disconnected the AVR for more than 10 seconds and changed the OCR1A value so the delay time must be less than 1 sec but it still blinks every second(OCCR1A = 200 NOT 31249)
#include <mega328p.h>
void TCT(void)
{
TCCR1A = (1<<WGM12)...
I just set WGM12 in TCCR1A, not TCCR1B(in datasheet WGM12 is in TCCR1B), and it is solved now(now i can see there is no difference between OCR1A and B)
Hi everyone
I don't know what's happened but it seems that the time/counter unit is not working
I'm writing code for atmega328pu in arduino uno with codevision,I was working on a project with 7 segment(counting up from 0 to 9 with 1 second delay) and everything was ok until the 7 segment...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.