Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

[Help] Assembly program for 8052 (ADC serial in)

Status
Not open for further replies.

xela

New Member
I am going to use 8052 to recieve data of three 8-bit serial digital outputs from ADC.
That means I want to store the serial digital data into the registers in 8052. I want to ask the program of convertion.
All I know is to enable clip select(CS),a CLK signal to control the ADCs.
(However I have 3 series of data to read in. One by one)
May I request for some practical examples for this assembly program?

Thank you

microcontroller : Atmel 8052
Serial output ADC: ADC0831

https://www.electro-tech-online.com/custompdfs/2007/03/26633.pdf

P.S.:why my reply doesn't show...?
 
Last edited:
Presumably yet another homework/classwork question? - and we can guess what part of the world it's from as it's using long out of date components!.

Actually it's not from the usual place, but not too far away!.
 
Nigel Goodwin said:
Presumably yet another homework/classwork question? - and we can guess what part of the world it's from as it's using long out of date components!.

Actually it's not from the usual place, but not too far away!.

Ya, you are right. A part of a project. The use of components are decided by me, coz i've learnt to program 8051/52 only.

In fact I have a program which has not been tested yet. Also it may able for one input only.

here it is
AD_CS BIT P1.0 ;CS, CK and DO fitted to port 1
AD_CK BIT P1.1
AD_DO BIT P1.2
AD_RESULT equ 030h; ;This variable holds result from A/D conversion.
;
MOV P1, 0FFh
CLR AD_CK
CLR AD_CS ;Select chip (initiate conversion)
;
MOV R1, #02h
;
PREPARE: SETB AD_CK ;MUX settling time
ACALL delay_us
CLR AD_CK
ACALL delay_us
DJNZ R1, PREPARE

MOV R2,AD_RESULT
MOV R1, #08h ;Read in value from A/D convertor, 8 BITS
CONVERSION: SETB AD_CK
ACALL delay_us
MOV C, AD_DO
MOV A, R2
RLC A ;Left because MSB comes in first
MOV R2, A
CLR AD_CK
ACALL delay_us
DJNZ R1, CONVERSION
MOV AD_RESULT, R2

SETB AD_CK ;cycle clock once.
ACALL delay_us;
CLR AD_CK
ACALL delay_us;

SETB AD_CS ;Deselect chip.

delay_us: ;FOR STANDARD 12 CYCLE and 11.0592 MHz
MOV R3, #05h ;10 uS
DJNZ R3, $
RET
 
I have working code for 2 TLC549 from TI and 80C31 from Philips :)

Let's proceed step by step:
1) Hardware
You wrote that you have 3 8031 ADC's but I can find only one Chip Select in your code (P1.0). How do you expect the others to work?
First define ALL the hardware you need. Assign a µC pin for each 8031 pins you think you need to use. Don't forget pull-up pull-down resistors.
Once you post a suggestion I (and others:)) will check it for you.

2) Read and understand the datasheet
Especially the timing part so that you understand how the 8031 is working. Do you need adressing, setup (SE, differential) the 8031?

3) Flow chart
Make a flow chart of all the actions the code need to do. Reading ADC's, display data(?), ... ...

4) Start coding



As you probably noticed, I won't give you a solution, I will help you toward a solution:)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top