csdn回帖时怎样粘贴代码块

lostinginto 2012-07-14 10:48:01
回帖的时候没有发现什么按钮
...全文
792 54 打赏 收藏 转发到动态 举报
写回复
用AI写文章
54 条回复
切换为时间正序
请发表友善的回复…
发表回复
laichunhui 2015-01-24
  • 打赏
  • 举报
回复
c/c++ code int (main) { printf("好像不行\n"); return0; }
lewes1103 2014-12-17
  • 打赏
  • 举报
回复

可以吗
lewes1103 2014-12-17
  • 打赏
  • 举报
回复
Java code 1 2 3 看看行不行
zproo 2014-10-25
  • 打赏
  • 举报
回复
" Java code ? 1 System.out.println("hello JAVA");"
zproo 2014-10-25
  • 打赏
  • 举报
回复
[code=java] [System.out.println("hello JAVA");]
zproo 2014-10-25
  • 打赏
  • 举报
回复
Java code
「已注销」 2014-09-25
  • 打赏
  • 举报
回复

class fk{
 
}
licwang13 2014-09-16
  • 打赏
  • 举报
回复
"11"
licwang13 2014-09-16
  • 打赏
  • 举报
回复
"shishi"
付晓宇 2014-09-05
  • 打赏
  • 举报
回复
class test{
int age;}
再试试
付晓宇 2014-09-05
  • 打赏
  • 举报
回复
class test1{ } 试试
hutiwang 2014-08-04
  • 打赏
  • 举报
回复

package com.yuxiaofei.myhandlertest01;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

public class MainActivity extends Activity {

	private Button button = null;
	private TextView textView = null;
	private ProgressBar progressBar = null;
	private int i = 1;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		button = (Button)findViewById(R.id.buttonId);
		textView = (TextView)findViewById(R.id.textViewId);
		progressBar = (ProgressBar)findViewById(R.id.progressBarId);
		
		button.setOnClickListener(new ButtonListener());
		
	}

	
	private Runnable myRun = new Runnable() {
		
		@Override
		public void run() {
			// TODO Auto-generated method stub
			
			Message msg = handler.obtainMessage();
			msg.arg1 = i;
			handler.sendMessage(msg);
			i++;
			System.out.println("Thread run ---->" + Thread.currentThread().getName());
			
		}
	};
	
	
	class ButtonListener implements OnClickListener {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			
			handler.post(myRun);
			System.out.println("Thread button ---->" + Thread.currentThread().getName());
		}
		
	}
	
	private Handler handler = new Handler(){

		@Override
		public void handleMessage(Message msg) {
			// TODO Auto-generated method stub
			super.handleMessage(msg);
			
			
			System.out.println("current progress --->" + msg.arg1);
			
			System.out.println("Thread handleMessage ---->" + Thread.currentThread().getName());
			textView.setText(String.valueOf(msg.arg1));

			progressBar.setProgress(msg.arg1);
			
			       
			try {
				Thread.sleep(200);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			handler.post(myRun);
			
			if(i>100){  
				handler.removeCallbacks(myRun);  
	            
	        } 
			
		}
		
	};
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}

lawlite9 2014-07-29
  • 打赏
  • 举报
回复
NSLog(@"hello, world");
fxd321 2014-06-20
  • 打赏
  • 举报
回复
/**************************************************
**	文件名:main.c
**	版本号:V 1.0
**	文件说明:自定义的主函数,当汇编部分执行完成后,
**		跳转到本文件的main函数中,完成对uCOS-II的任务初始化等,
**		最后调用任务管理器,并开始任务调用。
***************************************************/

#include "config.h"

extern void Lcd_Display(void);
extern void Lcd_printf(const char *fmt,...);
//void Task_LCD(void *p);

/*****************【任务相关自定义变量】*****************/
OS_STK  MainTaskStk[MainTaskStkLengh];
OS_STK	Task0Stk [Task0StkLengh];       // Define the Task0 stack 
OS_STK	Task2Stk [Task2StkLengh];       // Define the Task2 stack
OS_STK	Task3Stk [Task3StkLengh];       // Define the Task3 stack 

OS_EVENT *Semp;                         //Creat semp

U8 err;
int rYear, rMonth,rDay,rDayOfWeek,rHour,rMinute,rSecond;
//建立一个任务用变量,实现该任务第一次运行时,就需要初始化,之后再运行该任务时则不需要进行初始化
int user_task0_firstboot = 1;
int user_task2_firstboot = 1;
int user_task3_firstboot = 1;

int Main(int argc, char **argv)
{
	//初始化目标板
	TargetInit(); 

	//初始化uCOS-II
	OSInit ();	 

	//初始化系统时基
	OSTimeSet(0);

	//创建系统初始任务
	OSTaskCreate (MainTask,(void *)0, &MainTaskStk[MainTaskStkLengh - 1], MainTaskPrio);

	//开始任务
	OSStart ();

	return 0;
}

void MainTask(void *pdata) //Main Task create taks0 and task1
{
	#if OS_CRITICAL_METHOD == 3		/* Allocate storage for CPU status register */
		OS_CPU_SR  cpu_sr;
	#endif
	OS_ENTER_CRITICAL();

	Timer0Init();				//initial timer0 for ucos time tick
	ISRInit();				//initial interrupt prio or enable or disable

	OS_EXIT_CRITICAL();

	OSPrintfInit();	//create task to print massage to Uart 

	OSStatInit();
	OSTaskCreate (Task0,(void *)0, &Task0Stk[Task0StkLengh - 1], Task0Prio);		
	OSTaskCreate (Task2,(void *)0, &Task2Stk[Task2StkLengh - 1], Task2Prio);
	OSTaskCreate (Task3,(void *)0, &Task3Stk[Task2StkLengh - 1], Task3Prio);	 
	while(1)
	{
		OSPrintf("\nEnter Main Task\n");
		OSTimeDly(OS_TICKS_PER_SEC);
	}
}

void Task0(void *pdata)				//任务0,打印CPU占用率
{
	while (1)
	{
	//	OSPrintf("\nEnter Task0\n"); 
	//	OSPrintf("CPU Usage: %d%%\n",OSCPUUsage); //通过串口打印CPU占用率,调用系统变量实现

		OSTimeDly(OS_TICKS_PER_SEC);  //5ms * 200 =1s
	}
}



void Task2(void *pdata)
{
	unsigned int i, x, m, n, k, y;
	int tmp,key;         

	int width = 10;
	int height = 100;

	if(user_task2_firstboot == 1)
	{
		//LCD 初始化
		Lcd_Display();
		Rtc_Init();
		user_task2_firstboot = 0;
	}

	while(1)
	{
		i++;
		if(i>99)i=0;

		if(rBCDYEAR == 0x99)
			rYear = 1999;
		else
			rYear    = (2004 + rBCDYEAR);
			rMonth   = FROM_BCD((rBCDMON+3) & 0x1f);
			rDay		= FROM_BCD((rBCDDAY+18) & 0x03f);
			rDayOfWeek = rBCDDATE -4;
			rHour    = FROM_BCD(rBCDHOUR & 0x3f);
			rMinute     = FROM_BCD(rBCDMIN & 0x7f);
			rSecond     = FROM_BCD(rBCDSEC & 0x7f);

		OSTimeDly( 5 );
		OSPrintf("\nEnter Task2\n");	
		OSPrintf("LCD display Test!\n\n");	

		//在LCD上打印日期,星期,时间
		Lcd_printf(0,95,RGB( 0xFF,0xFF,0xFF),RGB( 0x00,0x00,0x00),0,"时间:%4d-%02d-%02d 星期%d  %02d:%02d:%02d\n",
        	      rYear, rMonth, rDay,rDayOfWeek, rHour, rMinute, rSecond);

		Lcd_printf(84,122,RGB( 0x00,0xFF,0x00),RGB( 0x00,0x00,0x00),1," 基于uC/OS2的AD转换设计");
		
		Lcd_printf(250,200,RGB( 0x00,0x1C,0xC0),RGB( 0xF0,0x00,0x00),1," B09212 胡雁鹏");

		OSTimeDly(OS_TICKS_PER_SEC/5);
	}
}


void Task3(void *pdata)				
{
	
	if(user_task3_firstboot == 1)
	{
		 rADCDLY = 100;				//ADC转换延时	
//    rADCTSC = 0;				//设置ADC为普通模式
   								/* 进行ADC模块设置,其中x<<n表示第n位设置为x(若x超过一位,则向高位顺延) */
    rADCCON = (0 << 0)     |	// ADC转换设置 未设置
              (0 << 1)     |    // 读AD数据触发AD转换 未使用
              (0 << 2)     |    // StandBy模式选择 为普通操作模式
              (0 << 3)    |    // ADC通道选择 ch
              (49 << 6)    | 	// CLKDIV = Fpclk /49+1/5 ,即转换时钟为1MHz  Fpclk = 10M   ADC转换频率400K
              (1 << 14)   ;	    // 使能软件预设值

		user_task3_firstboot = 0;
	}
	
	while(1)
	{
			OSPrintf("ADC start!\n");
			
			AD_ENABLE();
			OSTimeDly(OS_TICKS_PER_SEC/5);
	}		

}

fxd321 2014-06-20
  • 打赏
  • 举报
回复
dim a as string
fxd321 2014-06-20
  • 打赏
  • 举报
回复
dim a as string
萧萧的csdn 2014-06-16
  • 打赏
  • 举报
回复

这样
2014-03-31
  • 打赏
  • 举报
回复
是这样么
这样子
2014-03-31
  • 打赏
  • 举报
回复
是这样么 这样子 上一个不对
2014-03-31
  • 打赏
  • 举报
回复
是这样么 这样子
加载更多回复(33)

15,446

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧