2440 Bare Metal Program - Marquee

Publisher:RadiantGlowLatest update time:2022-02-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Four programs need to be added to the project: S3C2440A.s; 2440lib.c; main.c; led.c.


Main program:


/*********************************************************************************************

* File name: main.c

* Author: ZXL 

* Description: 1. Marquee 2. LED lights display 1-15 in binary format

* History: 2013.5.5

*********************************************************************************************/


#include "def.h"

#include "option.h"

#include "2440addr.h"     

#include "2440lib.h"

   

void dely(U32 tt)

{

   U32 i;

   for(;tt>0;tt--)

        for(i=0;i<10000;i++);

}



void init()

{

U32 i;

U8 key;

U32 mpll_val=0;

    i = 2 ; 

switch ( i ) //Set the clock frequency of 2440

{

case 0:  //200

key = 12;

mpll_val = (92<<12)|(4<<4)|(1);

break;

case 1:  //300

key = 13;

mpll_val = (67<<12)|(1<<4)|(1);

break;

case 2:  //400

key = 14;

mpll_val = (92<<12)|(1<<4)|(1);

break;

case 3:  //440!!!

key = 14;

mpll_val = (102<<12)|(1<<4)|(1);

break;

default:

key = 14;

mpll_val = (92<<12)|(1<<4)|(1);

break;

}

//MDIV=92,PDIV=1,SDIV=1 Determined by configuring MPLLCON, MPLL, that is, FCLK=400MHZ

ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);

ChangeClockDivider(key, 12);  //FCLK:HCLK:PCLK = 1:1/4:1/8 =400M:100M:50M

    

Port_Init();

  

Uart_Init(0,115200);

    Uart_Select(0);   

Uart_Printf("nLED Test Begin!n");

}  

   

int main(int argc, char **argv)

{

heat();

led_port_init(); 

    while(1)

    {     

      led();

    }        

}  



LED Program:



/*********************************************************************************************

* File name: led.c

* Author: ZXL 

* Description: 1. Marquee 2. Press numbers 1-15 to light up the LED lights incrementally

* History: 2013.5.5

*********************************************************************************************/



#include "def.h"

#include "2440lib.h"  

#include "2440addr.h" 



#define LED1_ON   ~(1<<5)

#define LED2_ON   ~(1<<6)

#define LED3_ON   ~(1<<7)

#define LED4_ON   ~(1<<8)



#define LED1_OFF   (1<<5)

#define LED2_OFF   (1<<6)

#define LED3_OFF   (1<<7)

#define LED4_OFF   (1<<8)



void led_port_init()

{

rGPBCON &= ~((3<<10)|(3<<12)|(3<<14)|(3<<16)); //Control register clear

    rGPBCON |= (1<<10)|(1<<12)|(1<<14)|(1<<16); //Control register is set to output

rGPBDAT |= (LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF); //All LED lights are off

}



void disp_num(int data)

{

  if(data & 0x01)   rGPBDAT &= (LED1_ON);

     else           rGPBDAT |= (LED1_OFF);

  if(data & 0x02)   rGPBDAT &= (LED2_ON);

     else           rGPBDAT |= (LED2_OFF);

  if(data & 0x04)   rGPBDAT &= (LED3_ON);

     else           rGPBDAT |= (LED3_OFF);

  if(data & 0x08)   rGPBDAT &= (LED4_ON);

     else           rGPBDAT |= (LED4_OFF);     

}



void led() //LED lights display 1-15 in binary mode

{

  U32 i;

for(i=0;i<16;i++)

{

 disp_num(i);

 daily(100);

}

}

 

/*

void led()

{

//Marquee program

while (1)

rGPBDAT &= (LED1_ON);

daily(100);

rGPBDAT |= (LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);

daily(100);

rGPBDAT &= (LED2_ON);

daily(100);

rGPBDAT |= (LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);

daily(100);

rGPBDAT &= (LED3_ON);

daily(100);

rGPBDAT |= (LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);

daily(100);

rGPBDAT &= (LED4_ON);

daily(100);

rGPBDAT |= (LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);

daily(100);

}    

}

*/

Reference address:2440 Bare Metal Program - Marquee

Previous article:2440 bare metal program - key interrupt
Next article:S3C2440 bare metal -------I2C_S3C2440 I2C controller control timing

Recommended ReadingLatest update time:2024-11-16 20:30

Detailed explanation of 2440init.s of s3c2440_Supplement
1.S3C2440 supports two boot modes: NAND FLASH and NOR FLASH. There are many articles on the Internet that analyze the startup file 2440init.s of TQ2440. The introduction is very detailed. Here I just describe the program flow after S3C2440 is powered on. Regardless of the startup mode, ARM starts running from 0X00
[Microcontroller]
s3c2440 IRQ processing process
Note that the ucos code (that is, the code in the main function) and the startup code both work in Supervisor mode, while IRQ works in External Interrupt mode. The register sets used in these two modes are different, so be sure to keep the corresponding registers when switching modes. If I set timer 2 to generate an
[Microcontroller]
1.3.3 SDRAM Settings
The 2440 CPU is connected to the external SDRAM through a memory controller, and the development board has an external 64MB SDRAM. For a detailed introduction to SDRAM, please refer to "The Ultimate Memory Technology Guide for Advanced Users - Complete Advanced Edition", attached link https://max.book118.com/html/20
[Microcontroller]
1.3.3 SDRAM Settings
u-boot-2011.03 porting on mini2440/micro2440 supports Nand Flash
5.1 Add s3c2440_nand.c $ touch drivers/mtd/nand/s3c2440_nand.c $ cat drivers/mtd/nand/s3c2440_nand.c #include common.h #if 0 #define DEBUGN    printf #else #define DEBUGN(x, args ...) {} #endif #include nand.h #include asm/arch/s3c24x0_cpu.h #include asm/io.h #define
[Microcontroller]
u-boot-2011.03 porting on mini2440/micro2440 supports Nand Flash
u-boot-2011.03 porting on mini2440/micro2440 supports kernel booting
4.1 include/conskfigs/micro2440.h Add to #define CONFIG_SETUP_MEMORY_TAGS 1 //If this parameter is not defined, the uboot parameter must add men=memory size #define CONFIG_INITRD_TAG 1 #define CONFIG_CMDLINE_TAG 1 //Set bootargs to enter and exit the kernel #define CONFIG_BOOTARGS "noinitrd roo
[Microcontroller]
Online S3C2440 driver TFT screen information
Online information TFT screen - supports monochrome, 4-level grayscale, 256-color palette display mode - supports 64K and 16M color non-palette display mode - supports LCD with resolution of 640*480, 320*240 and other specifications For controlling the TFT screen, in addition to sending it video data (VD ), the fo
[Microcontroller]
Online S3C2440 driver TFT screen information
S3C2440 UART/Serial Port (I)
Serial Port: Function: 1: Under TTL/CMOS logic level, 5v corresponds to logic '1', and 0v corresponds to logic '0'. TX RX remains high when idle. 2: RS--232 logic level. Normally, the serial port output of the ARM chip is TTL level, and a level conversion chip is required to convert the TTL level into 232 level
[Microcontroller]
S3C2440 UART/Serial Port (I)
[Study Notes] ARM9-mini2440 lights up the first LED
This article records the operation process of mini2440 lighting up the LED; Light up an LED code implementation method: assembly and C; Conducted some functional expansion experiments; The basic idea Look at the schematic diagram to determine the pins that control the LED; See the main chip manual to determine how t
[Microcontroller]
[Study Notes] ARM9-mini2440 lights up the first LED
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号