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.

help for display set pixel and ADC reading functions

Status
Not open for further replies.

jackcmos

Newbie level 1
Newbie level 1
Joined
Feb 6, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,289
i am new learner try to do the following task:


The system required is to act as a simple oscilloscope, utilising a 256x256 display to graph the analogue inputs to a microcontroller.
The microcontroller is a 32 bit machine, big-endian. Memory addresses are directed to bytes, with 16 bit accesses limited to even addresses, and 32 bit accesses limited to multiples of 4.
The ADC has a resolution of 16 bits, and can do an A/D conversion in a single instruction
The memory map of the micro is as follows:

0x00000..0x0FFFF Code/data space
0x10000..0x1FFFF Display, 8 bits wide, mapped x first
0x20000..0x20001 A/D

You have been provided with the following function prototypes:

Code:
typedef unsigned short ushort;
typedef unsigned char ubyte;
void Display_Clear( void );
void Display_SetPixel( ushort x, ushort y, ubyte intensity );
short ADC_Read( void );

1) How might Display_SetPixel be coded?
Code:
//my code, but i think it might not correct.

void Display_SetPixel( ushort x, ushort y, ubyte intensity )
{
  
  int  DisplayBufferSize = (x * y);

unsigned  char  DisplayImage [DisplayBufferSize / 8];	


// here I assumed bytes describe the vertical stripes

	unsigned  char  * byte = &DisplayImage[x + (y / 8) * x];
	if (intensity)
		*byte |= 1 << (x % 8);
	else
		*byte &= ~(1 << (x % 8));
}

2) Write the code to plot the ADC readings on the display, to act as an oscilloscope. Please list any assumptions you have made about the system.
Code:
adc_result = (ReadADC()) / 2; 
Display_Clear();
//how to match the adc_result on to the display???
//please help!
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top