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.

How to translate code from AT90S2313 to AT89C2051 or 8051?

Status
Not open for further replies.
Re: Code translation

No other way, you have to manual translate it!
That AVR code is not complex, you can direct translate itu to 8051 code, but be sure with timing.
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Forgot about translation, because these 8051 is too slow !!!
Yoy need RISC CPU with 1 command to one clock and CPU working from 17.7MHz.
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Dainis is right: to generate colour bars 2051 is to slow ..

However, if you want to generate black-and-white vertical bars (including gray levels between white and black) you can translate this code (translation in this case is really trivial) and modify it in such a way that the loop time is ≈64µs = 1 TV line ..
Also, you will have to select the fastest possible crystal - 24MHz ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Thank you all.
I need only dark gray or black background.
How will code for 2051 look like?
 

Re: Code translation

It is not possible by 2051 ! :(
Choose faster 8051 (with 1 command to CLK), or AVR or PIC, or SX Scenix (Ubicom, now Paralax ?)
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Well, it is possible to generate gray screen with 2051 with 11,0592MHz crystal ..
Here is the code:
Code:
;***********************************************************************************
;*
;*	8051 with 11,0592 MHz crystal ..
;*
;***********************************************************************************


;---------------------------------------------------------------------

		ORG		0000h

;----------------------------------------------------------------------

Start:	
		MOV		P1, #1		; Start with black ..

		NOP
		NOP

		MOV		P1, #0		; Horizontal sinchronization ..

		MOV		P1, #1		; Back to black ..
		NOP
		NOP		

		MOV		P1, #2		; Start gray ..

		MOV		R0, #22
Delay:	DJNZ		R0, Delay

		LJMP		Start

;----------------------------------------------------------------------

		END

and use only P1.0 and P1.1 with 4.7kΩ pullups and resistor network as per attached drawing ..
Also, you will need a simple voltage follower/buffer between the output and any 75Ω video input ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Code translation

now there is faster 8051-based CPU come out, and using C language will be easier to migrate.
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Hi IanP.
I build this circuit with buffer and it works with normal monitor but if I connect this signal to video screen writter the background is there but there is no characters displayed on screen. Why?
 

Re: Code translation

Most likely your video on-screen display requires composite video signal with both sync pulses (H and V) present ..

This code generates only H pulses, what is enough for TV monitors, but is not enough for circuits that require both sync sygnals ..

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Re: Code translation

Hi IanP
Yeah, I forgot about V sync.
Can V sync be added to this code?
If yes, how?
 

Re: Code translation

Try the following code:
Code:
$NOPAGING
$MOD252

;**********************************************************************
;*
;*	8051 with 11,0592 MHz crystal ..
;*
;**********************************************************************

Port		DATA		80h			; P0

;----------------------------------------------------------------------

		ORG		0000h

;----------------------------------------------------------------------

Start:

Line_1_2_3:	LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse

Line_4_5_6:	LCALL		Serration_Pulse
		LCALL		Serration_Pulse
		LCALL		Serration_Pulse
		LCALL		Serration_Pulse
		LCALL		Serration_Pulse
		LCALL		Serration_Pulse

Line_7_8_9:	LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse
		LCALL		Equalizing_Pulse

Line_10:	MOV		R1, #250

Main_Loop1:	
		MOV		Port, #1		; Start with black ..
		NOP
		NOP
		MOV		Port, #0		; Horizontal sinchronization ..
		MOV		Port, #1		; Back to black ..
		NOP
		NOP		
		MOV		Port, #2		; Start gray ..
		MOV		R0, #21
Delay1:	DJNZ		R0, Delay1
		DJNZ		R1, Main_Loop1

Line_260:	MOV		R1, #250

Main_Loop2:	
		MOV		Port, #1		; Start with black ..
		NOP
		NOP
		MOV		Port, #0		; Horizontal sinchronization ..
		MOV		Port, #1		; Back to black ..
		NOP
		NOP		
		MOV		Port, #2		; Start gray ..
		MOV		R0, #21
Delay2:	DJNZ		R0, Delay2
		DJNZ		R1, Main_Loop2

Line_510:	MOV		R1, #115

Main_Loop3:	
		MOV		Port, #1		; Start with black ..
		NOP
		NOP
		MOV		Port, #0		; Horizontal sinchronization ..
		MOV		Port, #1		; Back to black ..
		NOP
		NOP		
		MOV		Port, #2		; Start gray ..
		MOV		R0, #21
Delay3:	DJNZ		R0, Delay3
		DJNZ		R1, Main_Loop3

		LJMP		Start		

;----------------------------------------------------------------------
;Synchro pulses
;----------------------------------------------------------------------

Equalizing_Pulse:

		MOV		Port, #1		; Start with black ..
		MOV		R0, #12
Delay4:	DJNZ		R0, Delay4
		MOV		Port, #0		; Horizontal sinchronization ..
		MOV		Port, #1		; Back to black ..
		RET

Serration_Pulse:

		MOV		Port, #0
		MOV		R0, #12
Delay5:	DJNZ		R0, Delay5
		MOV		Port, #1
		MOV		Port, #0
		RET		

;-----------------------------------------------------------------------
		END

Of course, you will have to "see" the timing on an oscilloscope and only !!! if it is correct you can connect it to a TV monitor ..
I haven't test it !!!

Regards,
IanP
 

    DrWhoF

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top