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.

interfacing ADXL202 to 8051

Status
Not open for further replies.

zahidkhan

Member level 2
Joined
Aug 5, 2004
Messages
52
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
428
adxl202

hi
i am trying to interface adxl202 accelerometer with atmel c51.adxl202 gives output in the form of duty cycles (PWM).Should i use uC in counter mode or timer mode and what should be aquisition time .
Any helping suggestion will be appriciated.
thanks u all.
 

accelerometer adxl interfacing

You can connect both outputs at the INTx inputs of the MCU. Enable both external interrupts (EX0=EX1=1) and configure them for edge triggering (IT1=IT0=1). Use timers 0 and 1 to count when the wave is at 1 logic, enable them (TR0=TR1=1) and configure them to run only when INTx=1 (GATE Timer0=Gate timer1=1). You will have to choose the timer mode M1,M0 to either 00 (13 bit) or 01 (16 bit) for both timers, in such a way that the full counter period for the chosen timer mode is as close as possible to the duration of the signal generated by accelerometer. You will have to consider the MCU clock speed, MCU timer dividers (if you use modified 8051 architectures) and resistors from ADXL which sets the output period. The mechanism is simple, when the output becomes 1, then the counter starts, and when it becomes 0, it will stop. In the same time, an interrupt will be generated, and in the interrupt routine you'll have to read the values from THx,TLx, then clear them, because at the next cycle, the count must begin from 0, then RETI from interrupt.

/pisoiu
 
adxl opamp

Here is application note from Microchip on how to measure tilt with ADXL202 with PIC microcontroller. Although it based on PIC, and the end part with PIC software will be rather useless, but most of this note is related to ADXL202 itself and will show you how to determine clock frequeny, duty cycle etc etc and how to interface ADXL to a microcontroller. I think you will find this note quite interesting.
https://ww1.microchip.com/downloads/en/AppNotes/00715a.pdf
Regards,
IanP
 

interfacing adxl202

thanks it is very helpful but one thing i wanna ask is c51 has two external int. but i want to interface further two accelerometers to it.will i run out of interrupts c51 can handle.?
and in future if i add gyros what will be the secenario.






pisoiu said:
You can connect both outputs at the INTx inputs of the MCU. Enable both external interrupts (EX0=EX1=1) and configure them for edge triggering (IT1=IT0=1). Use timers 0 and 1 to count when the wave is at 1 logic, enable them (TR0=TR1=1) and configure them to run only when INTx=1 (GATE Timer0=Gate timer1=1). You will have to choose the timer mode M1,M0 to either 00 (13 bit) or 01 (16 bit) for both timers, in such a way that the full counter period for the chosen timer mode is as close as possible to the duration of the signal generated by accelerometer. You will have to consider the MCU clock speed, MCU timer dividers (if you use modified 8051 architectures) and resistors from ADXL which sets the output period. The mechanism is simple, when the output becomes 1, then the counter starts, and when it becomes 0, it will stop. In the same time, an interrupt will be generated, and in the interrupt routine you'll have to read the values from THx,TLx, then clear them, because at the next cycle, the count must begin from 0, then RETI from interrupt.

/pisoiu
 

adxl202 e microcontrolador

Yes, this can be a problem. Using this method, you will use all external interrupts and both timers which can work in this mode, leaving no room for extensions. Perhaps a multiplexer will solve your problem, and measuring on the same INTx inputs, one accelerometer at the time, then switching to the next one, and so on. But in this case you will miss some samples. If the events you want to measure are not quick, this may not be an inconvenient.

/pisoiu
 

    zahidkhan

    Points: 2
    Helpful Answer Positive Rating
adxl202 application

I would design a "mother board" with slots for small cards. Each card will have its microcontroller and each card will operate only with one sensor.
The main microcontroller on the mother board will have in this case enough time to interrogate each card for results and process them at your will without loosing vital information from all sensors.
By doing this you can add almost as many cards as you wish..
Regards,
IanP
 

    zahidkhan

    Points: 2
    Helpful Answer Positive Rating
adxl202 + 8051

how can we multiplex the signals without compromising thel loss of any signal
pisoiu said:
Yes, this can be a problem. Using this method, you will use all external interrupts and both timers which can work in this mode, leaving no room for extensions. Perhaps a multiplexer will solve your problem, and measuring on the same INTx inputs, one accelerometer at the time, then switching to the next one, and so on. But in this case you will miss some samples. If the events you want to measure are not quick, this may not be an inconvenient.

/pisoiu

Added after 4 minutes:

will u please ellaborate it more i.e should i use c51 for sensors as well as for motherboard. what is the efficient way to do this.


IanP said:
I would design a "mother board" with slots for small cards. Each card will have its microcontroller and each card will operate only with one sensor.
The main microcontroller on the mother board will have in this case enough time to interrogate each card for results and process them at your will without loosing vital information from all sensors.
By doing this you can add almost as many cards as you wish..
Regards,
IanP
 

interfacing accelerometer to 8051

That depends on what you want to do with the collected data .. but because the "main" mcu will be free from any other functions, I would say that another 8051 will be sufficient enough to display whatever you want on LCD/LED, or pass data to a PC, or any other function ..
You will need 2 control pins per card to exchange data between cards and the mcu: one to inform the mcu that the gathered data is ready for collection and the second to handshake the transmission .. and 8-bit common data bus, say P.1.0-P.1.7 ..
Regards,
IanP
 

adxl202 + altitude

You can use 3state buffers, like 74HC125. However, it is impossible to avoid missing of samples using this method, because when you perform measurement on one acc., the others will be disconnected. Another issue is that the first cycle after you switch to a certain accelerometer must be ignored, because you will not know the moment when the mux is enabled, relatively to the pulse, and this can affect the measurement.
If you cannot afford to miss samples, then the only method is described by IanP. You will need one MCU for every acc., and you will have to develope a communication protocol between them. This is simple for 51 family, using multiprocessor communication.

/pisoiu
 

adxl202 on adc

actually I am working on an IMU(Inertial Measurement Unit) as a Universityproject .that will have 3 accl. 3 gyros , a gps, temperature and altitude sensor.This is all i need .Now after consulting with u people i think c51 is not the proper choice.So what else should i go for.
regards...

pisoiu said:
You can use 3state buffers, like 74HC125. However, it is impossible to avoid missing of samples using this method, because when you perform measurement on one acc., the others will be disconnected. Another issue is that the first cycle after you switch to a certain accelerometer must be ignored, because you will not know the moment when the mux is enabled, relatively to the pulse, and this can affect the measurement.
If you cannot afford to miss samples, then the only method is described by IanP. You will need one MCU for every acc., and you will have to develope a communication protocol between them. This is simple for 51 family, using multiprocessor communication.

/pisoiu
 

adxl pic

Look, you will never be able to connect several devices that require constant attention using just one microcontroller ..
And, this has nothing to do with the selection of a microcontroller ..
8051(s) are as good as all the other mcus, just, as I mentioned before, designate one microcontroller per sensor, and you will be all right ..
Regards,
IanP
 

i have searched and seen commercially available as well as same projects of university students. they all have single processor to take care of the stuff on board.


IanP said:
Look, you will never be able to connect several devices that require constant attention using just one microcontroller ..
And, this has nothing to do with the selection of a microcontroller ..
8051(s) are as good as all the other mcus, just, as I mentioned before, designate one microcontroller per sensor, and you will be all right ..
Regards,
IanP
 

You can also try another approach, instead of working simultaneous with so many digital signals, perhaps you can convert them to analogic (you'll need an integrator, basically a cheap opamp and few R and C), then convert them to digital. You will have to find a suitable ADC, with enough inputs. Just an idea.....

/pisoiu
 

what about PIC (Programmable Interrupt Controller)...?


pisoiu said:
h**p://

You can also try another approach, instead of working simultaneous with so many digital signals, perhaps you can convert them to analogic (you'll need an integrator, basically a cheap opamp and few R and C), then convert them to digital. You will have to find a suitable ADC, with enough inputs. Just an idea.....

/pisoiu
 

how can i do it with polling technic ?
 

hi
i need to read 3D accelerometer with 8051 microcontroller (in C language) and show the readings in LCD screen. how can ı connect the accelerometer with 8051?

please someone help me.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top