FAQ | Points | Add... | Recent posts | Search | Register | Log in


[Atmega8][C]TID Vectra - nie wyświetla danych


Post new topic  Reply to topic      Main Page -> Forum Index -> Microcontrollers Generally -> AVR Microcontrollers -> [Atmega8][C]TID Vectra - nie wyświetla danych
Author
Message
vectra96
Poziom 10
Poziom 10


Joined: 20 Nov 2007
Posts: 49

Post#1 Post from the author of the topic 26 Nov 2009 12:58   

[Atmega8][C]TID Vectra


Witam, otrzymałem od elektrody kod programu napisany w c do obsługi wyświetlacza 8 znakowego w np Astrze, próbowałem go przerobić na wyświetlacz 10 znakowy w Vectrze ale niestety wyświetlacz nie reaguje, czy może ktoś zerknąć co mogło by być źle?

Code:


#include <avr/io.h>
#include <avr/interrupt.h>
#include "lib\delay.c"



unsigned char dana,i, t,s,d,j ,cnt1, z1, p;
unsigned int  liczba,b,a,cnt;                       //zmienne
char wi;

void puls_us(void)
{
delayus(400);
}
void startpuls(void) //czasy
{
delayus(200);
}
void sek(void)
{
delayms(1000);
}

void start(void)
{
DDRB = 0xFF;
PORTB=0xFF;    //strat
 PORTB |=_BV(3); //mrq=0;
 puls_us();
 PORTB &=~_BV(3); //mrq=1;                      //bit startu na magistrali I2C  START
 PORTB &=~_BV(1); //sda=1;
 PORTB &=~_BV(2); //scl=1;
 startpuls();
PORTB |=_BV(1); //sda=0;
 startpuls();
 PORTB |=_BV(2); //scl=0;
 startpuls();

}
void stop(void)  //STOP
{

 PORTB &=~_BV(3); //mrq=1;
 PORTB &=~_BV(2); //scl=1;
 startpuls();
 PORTB &=~_BV(1); //sda=1;
 //portb=28;
 }

 void send(unsigned char dana)   // wysyłanie
{

 for(i=0;i<8;i++)       //będzie 8 bitów
 {
  if(dana&0x80)         //badaj najstarszy bit wysyłanego znaku
  {
   PORTB &=~_BV(1); //sda=1;     //wyślij "1"
  }
  else
  {
  PORTB |=_BV(1); //sda=0;       //wyślij "0"
  }
  PORTB &=~_BV(2); //scl=1;
  puls_us();
  PORTB |=_BV(2); //scl=0;
  puls_us();
  dana<<=1;        //przygotuj następny bit do wysłania
  }
  PORTB &=~_BV(1); //sda=1;
  PORTB &=~_BV(2); //scl=1;
  puls_us();
  PORTB |=_BV(2); //scl=0;
 PORTB |=_BV(1); //sda=0;
  PORTB |=_BV(3); //mrq=0;
  puls_us();

 }

char table[10]={0x61,0x62,0x64,0x67,0x68,0x6b,0x6d,0x6e,0x70,0x73};   //tablica cyf

 void powitanie(void)
{
   for (p=0; p<10;p++) {
   start();
   startpuls();
   send(0x9B);
   startpuls();
   PORTB |=_BV(3); //mrq=0;
   startpuls();

   send(0x01);
   send(0x01);
   send(0x01);
   send(0x77);
   send(0x78);
   send(0x79);
   send(0x71);
   send(0x72);
   send(0x73);
   send(0x74);
   send(0x75);
   send(0x76);
   send(0x77);

   stop();
   delayms(100);
   }
   for (p=0;p<10;p++) {
   start();
   startpuls();
   send(0x9B);
   startpuls();
   PORTB |=_BV(3); //mrq=0;
   startpuls();
   send(0x01);
   send(0x01);
   send(0x01);
   send(0x77);
   send(0x78);
   send(0x79);
   send(0x71);
   send(0x72);
   send(0x73);
   send(0x74);
   send(0x75);
   send(0x76);
   send(0x77);

   stop();
   delayms(100);
   }
   wi++;
   }
 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void main () {         //główny program
DDRB = 0xFF;
PORTB=0xFF;


while(1) //(wi<1)
  {
  powitanie();
  }
 
}

Back to top
   
Google

Google Adsense


Post# Post from the author of the topic 26 Nov 2009 12:58   





Back to top
   
Balu
Poziom 24
Poziom 24


Joined: 02 Mar 2003
Posts: 4364
Location: Będzin / Gliwice

Post#2 26 Nov 2009 15:10   

Re: [Atmega8][C]TID Vectra


Znając życie inny adres:>
Back to top
   
Google

Google Adsense


Post# 26 Nov 2009 15:10   





Back to top
   
vectra96
Poziom 10
Poziom 10


Joined: 20 Nov 2007
Posts: 49

Post#3 Post from the author of the topic 26 Nov 2009 15:28   

Re: [Atmega8][C]TID Vectra


Twoim zdaniem adres send(0x9B); dla wyświetlacza 10 znakowego jet inny ?
Dla 8 znkowego to jest 0x96
Back to top
   
Google

Google Adsense


Post# Post from the author of the topic 26 Nov 2009 15:28   





Back to top
   
Balu
Poziom 24
Poziom 24


Joined: 02 Mar 2003
Posts: 4364
Location: Będzin / Gliwice

Post#4 26 Nov 2009 16:54   

Re: [Atmega8][C]TID Vectra


Nie mówię, że jest, a że może być:]
Back to top
   
Post new topic  Reply to topic      Main Page -> Forum Index -> Microcontrollers Generally -> AVR Microcontrollers -> [Atmega8][C]TID Vectra - nie wyświetla danych
Page 1 of 1
Similar topics
AtMega8 + hd44780 nie wyświetla... (16)
Problem z Tid-em Vectra B i BASCOM AVR (4)
nie wyświetla danych pobranych z formularza (14)
woltomierz LCD nie wyświetla kropki [ATMEGA8][c/codevision] (8)
[php i mysql] Coś nie wyświetla mi danych :| (2)
[Atmega8][C][HD44780] LCD nic nie wyświetla dla f>4MHz (24)
[Atmega8 bascom] odczyt danych z eepromu ale nie pojedyczych (7)
GPS (HI-204) + ATmega8. Nie mogę odebrać danych z GPS. (13)
LCD+Atmega8 - wyświetla kwadraciki. Co z wejściami D1-D3? (22)
[atmega8][c]LCD wyświetla same kwadraty (6)

Page generation time: 0.095 seconds


FAQ || Administrator || Moderators || Widgets and banners || Contact
elektroda.pl topic RSS feed