Академический Документы
Профессиональный Документы
Культура Документы
Go Down
PRINT (HTTPS://FORUM.ARDUINO.CC/INDEX.PHP?ACTION=PRINTPAGE;TOPIC=78634.0)
(https://forum.arduino.c /****************************************************************/
/* */
c/index.php?
/* Opel Astra G TID Ansteuerung */
action=profile;u=57133) /* I2C-Protokol */
/* */
Newbie /****************************************************************/
Posts: 13
Karma: 4 [add] #include <Wire.h>
(https://forum.arduino.c #define TID 0x9B
#define _SCL 5
c/index.php?
//#define _SCL_in 1
action=karma;sa=applau
#define _MRQ 4
d;uid=57133;bb4458e=6b //#define _MRQ_in 3
a4478e88ae3ec8916a702 #define _SDA 4
4dd46d5dc) //#define _SDA_in 5
#define PIN
void setup()
{
SDA_high();
SCL_high();
MRQ_high();
void loop()
{
MRQ_low();
SDA_low();
while(get_SDA()); //warte bis SDA low
delay(50);
MRQ_high();
while(!get_SDA()); //warte bis SDA high
delay(50);
SDA_low();
delay(50);
SCL_low();
delay(50);
Wire.begin();
Wire.beginTransmission(TID);
MRQ_low();
Wire.send(0x01); // Schalte Symbole aus
Wire.send(0x01); // Schalte Symbole aus
Wire.send(0x01); // Schalte Symbole aus
Wire.send(0x85);// B
Wire.send(0x8A);// E
Wire.send(0xA4);// R
Wire.send(0x8F);// G
Wire.send(0x83);// A
Wire.send(0x9B);// M
/
Wire.send(0x83);// A
N) P R O ( / / W W W . A R D U I Wire.send(0xA7);//
NO.CC/PRO) RS E S O U R C E S COMMUNITY HELP SIGN IN
Wire.send(0x86);// C
Wire.send(0x9E);// O
delay(50);
MRQ_high();
Wire.endTransmission();
SDA_high();
SCL_high();
MRQ_high();
delay(1000);
}
void MRQ_high(void)
{
PORTB &= ~(1<<_MRQ );
}
void MRQ_low(void)
{
PORTB |= (1<<_MRQ);
}
void SCL_high(void){
PORTC &= ~(1<<_SCL);
}
void SCL_low(void)
{
PORTC |= (1<<_SCL);
}
void SDA_high(void)
{
PORTC &= ~(1<<_SDA);
}
void SDA_low(void)
{
PORTC |= (1<<_SDA);
}
uint8_t get_MRQ(void)
{
return (PINB & (1<< _MRQ));
}
uint8_t get_SCL(void)
{
return (PINC & (1<< _SCL));
}
/
uint8_t get_SDA(void)
N) P R O ( / / W W W . A R D U{I N O . C C / P R O ) RESOURCES COMMUNITY HELP SIGN IN
return (PINC & (1<< _SDA));
}
Hi tuccer. Im new into programming. As i could notice , portA and stuff are related to
arduino port manipulation. Check this:
http://www.arduino.cc/en/Reference/PortManipulation
(https://forum.arduino.c
c/index.php?
action=profile;u=57133)
Newbie
Posts: 13
Karma: 4 [add]
(https://forum.arduino.c
c/index.php?
action=karma;sa=applau
d;uid=57133;bb4458e=6b
a4478e88ae3ec8916a702
4dd46d5dc)
the code
(https://forum.arduino.c
Code: [Select]
c/index.php?
action=profile;u=5457)
#define _MRQ 4
.....and... /
Edison Member void MRQ_high(void)
N) P R O ( / / W W W . A R D U I N{ O . C C / P R O ) RESOURCES COMMUNITY HELP SIGN IN
Posts: 1,021
PORTB &= ~(1<<_MRQ );
Karma: 30 [add]
}
(https://forum.arduino.c
c/index.php?
Is seting a particular pin on avr port B to 0 (which is odd given that it's called
action=karma;sa=applau MRQ_high). I believe that it is equivalent to Arduino digital pin 12. See the port
d;uid=5457;bb4458e=6b manipulation ref'd earlier and http://arduino.cc/en/Hacking/Atmega168Hardware
a4478e88ae3ec8916a702
4dd46d5dc) We could puzzle our way through all this but really, your best bet would be to poke
around where you found the code and see if there's a connection diagram.
Olduino - an arduino for the
first of us.
I'm interested in the project though. Can you show us the display? How will you get
access to it?
Hey Tuccer, Have you already succeeded in connecting the TID? And where did you find
the code? Maybe there is a newer improved version?
I know that asking someone to translate code would be too much to ask, but is there
any way someone could help a little here? As the code is too long to share in one post,
here is the complete code http://codetidy.com/4239/. A chunk of code is dedicated for
voltage measurement and display, and I'm not interested in it, so I don't need that.
Code: [Select]
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
TCCR0=0x00;
TCNT0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=0xFFFF
Edit:
I've found Arduino code that looks like it shoud work, but as my Arduino hasn't yet
arrived, I have no way of checking it:
Code: [Select]
#include <Wire.h>
void setup() {
pinMode(2, OUTPUT);
Wire.begin();
digitalWrite(2, LOW);
delay(200);
digitalWrite(2, HIGH);
delay(200);
Wire.beginTransmission(0x94);
It seems that this code follows procedure for sending text to the LCD:
1:Idle state all lines are high.
2:Pull MRQ low for a short period and let it go high again.
3:Send a "I2C Start"
4:Send the address byte, 0x94
5:Pull MRQ low.
6:Send 13 data bytes. (The 8 character display uses 10 databytes)
7:Let MRQ go high
8:Send "I2C Stop"
/
N) P R O ( / / W W W . A R D UWhat
I N O .do
C Cyou
/ P Rguys
O ) think?
RESOURCES COMMUNITY HELP SIGN IN
❝I think the transistors can work with the arduino but i have to connect one PNP and one NPN to
each other for controlling the SDA, SCL and MRQ lines. Is it right?
(https://forum.arduino.c
c/index.php?
action=profile;u=20276)
No, I2C is an open-collector bus, PNP pull-up transistors would stop it working.
Brattain Member
Posts: 33,861 Quote
Karma: 1733 [add]
(https://forum.arduino.c ❝Do I need any of these initializations for this code to work in Arduino?
c/index.php?
action=karma;sa=applau
d;uid=20276;bb4458e=6 No, the Arduino software does its own initialization.
ba4478e88ae3ec8916a70
24dd46d5dc) The code you found is assuming particular pins for each of the three pins, namely:
MRQ - pin 12 (port B, bit 4)
Arduino rocks
SCL - pin A5 (standard hardware SCL pin, port C bit 5)
SDA - pin A4 (standard hardware SDA pin, port C bit 4).
To pull MRQ low for instance the MRQ_low() routine sets pin 12 to HIGH, since pin 12
turns on the NPN transistor
(the collector of which thus pulls MRQ low).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]
I'll check everyting once my Arduino arrives, and then I'll report back here.
After three days of headache and frustration (great way to spend the holidays )i
came up with some working arduino code to drive my TID
(https://forum.arduino.c mind you, i can't write a proper library of functions because... i don't know how
c/index.php?
action=profile;u=160885) so here it is an arduino project that just writes the letter G on the third position of a 8
letters display, needs additional work to make it actually useful, but it's a good start i
Newbie think.
Posts: 36
Karma: 1 [add]
(https://forum.arduino.c https://www.box.com/s/be3ia25iven1ygk3rwzn
c/index.php? (https://www.box.com/s/be3ia25iven1ygk3rwzn)
action=karma;sa=applau
d;uid=160885;bb4458e=
6ba4478e88ae3ec8916a7
024dd46d5dc)
Hats off to you. But I can see you haven't used Arduino's I2C lib. Now, I have a question
about parity: is that a part of standard I2C protocol? I mean, can I just ditch those lines
of code and use Wire library? I have to ask because I can't try this as my Arduino hasn't
arrived yet.
(https://forum.arduino.c
c/index.php?
action=profile;u=160885)
Newbie
Posts: 36
Karma: 1 [add]
(https://forum.arduino.c
c/index.php?
action=karma;sa=applau
d;uid=160885;bb4458e=
/
6ba4478e88ae3ec8916a7
N) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
024dd46d5dc)
I was really hoping we could use Wire library, it would be so much simpler. Well, never
mind, I'll at least learn how to make libraries, if someone doesn't do that before me.
the public functions are slightly smarter than the basic one i wrote yesterday, so now
(https://forum.arduino.c
you can write directly a message, and if it's longer than 8 chars it will roll, and you can
c/index.php?
selectively toggle every symbol, clear only the text/symbols while leaving the other
action=profile;u=160885) untouched
Newbie
Posts: 36
Karma: 1 [add]
(https://forum.arduino.c
c/index.php?
action=karma;sa=applau
d;uid=160885;bb4458e=
6ba4478e88ae3ec8916a7
024dd46d5dc)
Go Up
PRINT (HTTPS://FORUM.ARDUINO.CC/INDEX.PHP?ACTION=PRINTPAGE;TOPIC=78634.0)
/
N) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
NEWSLETTER
Contact Us (//www.arduino.cc/en/Main/ContactUs)
About Us (//www.arduino.cc/en/Main/AboutUs)
Distributors (//store.arduino.cc/distributors)
Careers (//careers.arduino.cc)
Security (//www.arduino.cc/en/Main/Security)
© 2020 Arduino (//www.arduino.cc/en/Main/CopyrightNotice)
(https://www.facebook.com/official.arduino)
(https://twitter.com/arduino)
(https://www.instagram.com/arduino.cc/)
(https://github.com/arduino/)
(https://www.flickr.com/photos/arduino_cc)
(https://www.youtube.com/user/arduinoteam)