Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 16th March 2007, 02:59 PM   #1
Default [Help] Assembly program for 8052 (ADC serial in)

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

http://www.farnell.com/datasheets/26633.pdf

P.S.:why my reply doesn't show...?

Last edited by xela; 22nd March 2007 at 03:52 PM.
xela is offline  
Old 21st March 2007, 12:52 PM   #2
Default

what are the components you are using?
Do you have any datasheets?
johnsmith123 is offline  
Old 22nd March 2007, 03:44 PM   #3
Default

Quote:
Originally Posted by johnsmith123
what are the components you are using?
Do you have any datasheets?
mircocontroller: Atmel 8052

A/D converter: ADC0831
datasheet: http://www.farnell.com/datasheets/26633.pdf
xela is offline  
Old 22nd March 2007, 04:01 PM   #4
Default

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!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 22nd March 2007, 04:11 PM   #5
Default

Quote:
Originally Posted by Nigel Goodwin
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
Quote:
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
xela is offline  
Old 26th March 2007, 11:43 AM   #6
Default

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
mcs51mc is offline  
Reply

Tags
8052, adc, assembly, program, serial

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Need help badly on Inchworm and MPLAB thushy Micro Controllers 14 11th March 2007 07:05 PM
First Program in assembly, And Programmer Inchworm. Ayne Micro Controllers 10 9th March 2007 08:27 PM
Tough assembly program for the PIC16F84 asmpic Micro Controllers 34 3rd December 2004 07:50 PM
PIC16F877 serial program Erwin_Macaraig Micro Controllers 3 21st November 2004 04:31 PM
data to serial port and musicmatch program info leprien Electronic Projects Design/Ideas/Reviews 3 28th September 2003 02:02 AM



All times are GMT. The time now is 09:51 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker