#include "stm32f10x.h"
#include "serial.h"
#include "rtthread.h"
#include <rtdevice.h>
/***********************************************************************************************************
@ pin config USART1_REMAP = 0
@____________________________________________________________________________*/ #define UART1_GPIO_TX GPIO_Pin_9
#define UART1_GPIO_RX GPIO_Pin_10
#define UART1_GPIO GPIOA
#define RCC_APBPeriph_UART1 RCC_APB2Periph_USART1
#define UART1_TX_DMA DMA1_Channel4
#define UART1_RX_DMA DMA1_Channel5 /***********************************************************************************************************
@ Struct Definition
@____________________________________________________________________________*/
struct serial_ringbuffer serial_int_rx_buffer;
struct serial_ringbuffer serial_int_tx_buffer;
struct rt_serial_device serialx_device;
struct serial_user_data
{
USART_TypeDef* uart_device;
const char name[RT_NAME_MAX];
}; /***********************************************************************************************************
@ Hardware clock configuration
@____________________________________________________________________________*/
static void RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); /* Enable USART1 and GPIOA clocks */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE); } static void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; /* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_TX;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); } static void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; /* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); } /***********************************************************************************************************
@ model driven architecture interface
@____________________________________________________________________________*/
int serial_put_char(struct rt_serial_device *serial, char c)
{
USART_ClearFlag(USART1,USART_FLAG_TC);
USART_SendData(USART1, (u8) c);
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
return c;
} int serial_get_char(struct rt_serial_device *serial)
{
int ch = -;
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); if(USART_GetITStatus(user->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(serial->parent.flag & RT_DEVICE_FLAG_INT_RX); ch = USART_ReceiveData(user->uart_device); /* clear interrupt */
USART_ClearITPendingBit(user->uart_device, USART_IT_RXNE);
}
return ch;
} rt_err_t serial_control(struct rt_serial_device *serial, int cmd, void *arg)
{
u16 int_flag; //interrupt flag
FunctionalState NewState;
struct serial_user_data *user = (struct serial_user_data *)serial->parent.user_data; switch(*(rt_uint32_t *)arg)
{
case RT_SERIAL_RX_INT:
{
int_flag = USART_IT_RXNE;
break;
}
case RT_SERIAL_TX_INT:
{
int_flag = USART_IT_TC;
break;
}
default :
{
break;
}
} switch(cmd)
{
case RT_DEVICE_CTRL_SET_INT:
{
NewState = ENABLE;
break;
}
case RT_DEVICE_CTRL_CLR_INT:
{
NewState = DISABLE;
break;
}
default:
{
break;
}
}
USART_ITConfig(user->uart_device, int_flag, NewState);
} rt_size_t serial_dma_transmit(struct rt_serial_device *serial, const char *buf, rt_size_t size)
{ }
/***********************************************************************************************************
@Struct declaration
@____________________________________________________________________________*/
struct serial_configure serial_config =
{
,
,
,
,
,
, };
struct serial_user_data serial_user_struct=
{
USART1,
"usart1"
};
rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg);
struct rt_uart_ops serial_ops =
{
stm32_serial_config,
serial_control,
serial_put_char,
serial_get_char,
serial_dma_transmit
}; rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
struct serial_user_data* user = (struct serial_user_data *)serial->parent.user_data; RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration();
/*
serial->config = serial_config;
serial->int_rx = &serial_int_rx_buffer;
serial->int_tx = &serial_int_tx_buffer;
serial->ops = &serial_ops;
*/
USART_InitStructure.USART_BaudRate = ;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(user->uart_device, &USART_InitStructure);
USART_ClockInit(user->uart_device, &USART_ClockInitStructure); // rt_hw_serial_register(serial, user->name,
// RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
// user); /* enable interrupt */
USART_ITConfig(user->uart_device, USART_IT_RXNE, ENABLE); return RT_EOK;
} void rt_hw_usart2_init(void)
{
/* USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure; RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration();
*/
serialx_device.config = serial_config;
serialx_device.int_rx = &serial_int_rx_buffer;
serialx_device.int_tx = &serial_int_tx_buffer;
serialx_device.ops = &serial_ops;
/*
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(serial_user_struct.uart_device, &USART_InitStructure);
USART_ClockInit(serial_user_struct.uart_device, &USART_ClockInitStructure); */
rt_hw_serial_register(&serialx_device, serial_user_struct.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct); /* enable interrupt */
//USART_ITConfig(serial_user_struct.uart_device, USART_IT_RXNE, ENABLE); //stm32_serial_config(&serialx_device,&serial_config);
}

下面是第二份代码:

 #include "stm32f10x.h"
#include "serial.h"
#include "rtthread.h"
#include <rtdevice.h>
/***********************************************************************************************************
@ pin config USART1_REMAP = 0
@____________________________________________________________________________*/ /* USART1_REMAP = 0 */
#define UART1_GPIO_TX GPIO_Pin_9
#define UART1_GPIO_RX GPIO_Pin_10
#define UART1_GPIO GPIOA
#define RCC_APBPeriph_UART1 RCC_APB2Periph_USART1
#define USART1_TX_DMA DMA1_Channel4
#define USART1_RX_DMA DMA1_Channel5 #if defined(STM32F10X_LD) || defined(STM32F10X_MD) || defined(STM32F10X_CL)
#define UART2_GPIO_TX GPIO_Pin_5
#define UART2_GPIO_RX GPIO_Pin_6
#define UART2_GPIO GPIOD
#define RCC_APBPeriph_UART2 RCC_APB1Periph_USART2
#else /* for STM32F10X_HD */
/* USART2_REMAP = 0 */
#define UART2_GPIO_TX GPIO_Pin_2
#define UART2_GPIO_RX GPIO_Pin_3
#define UART2_GPIO GPIOA
#define RCC_APBPeriph_UART2 RCC_APB1Periph_USART2
#define UART2_TX_DMA DMA1_Channel7
#define UART2_RX_DMA DMA1_Channel6
#endif /* USART3_REMAP[1:0] = 00 */
#define UART3_GPIO_RX GPIO_Pin_11
#define UART3_GPIO_TX GPIO_Pin_10
#define UART3_GPIO GPIOB
#define RCC_APBPeriph_UART3 RCC_APB1Periph_USART3
#define UART3_TX_DMA DMA1_Channel2
#define UART3_RX_DMA DMA1_Channel3 /***********************************************************************************************************
@ Struct Definition
@____________________________________________________________________________*/
struct serial_user_data
{
USART_TypeDef* uart_device;
const char name[RT_NAME_MAX];
}; /***********************************************************************************************************
@ Hardware clock configuration
@____________________________________________________________________________*/
static void RCC_Configuration(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); /* Enable USART1 and GPIOA clocks */
RCC_APB2PeriphClockCmd(RCC_APBPeriph_UART1 | RCC_APB2Periph_GPIOA, ENABLE); /* Enable AFIO and GPIOD clock */
RCC_APB1PeriphClockCmd(RCC_APBPeriph_UART2, ENABLE); } static void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure; /* Configure USART1 Rx (PA.10) as input floating */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART1 Tx (PA.09) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART1_GPIO_TX;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(UART1_GPIO, &GPIO_InitStructure); /* Configure USART2 Rx as input floating */
GPIO_InitStructure.GPIO_Pin = UART2_GPIO_RX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(UART2_GPIO, &GPIO_InitStructure); /* Configure USART2 Tx as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = UART2_GPIO_TX;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(UART2_GPIO, &GPIO_InitStructure); } static void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; /* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); /* Enable the USART2 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = ;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); } static void DMA_Configuration(void)
{
#if defined (RT_USING_UART3)
DMA_InitTypeDef DMA_InitStructure; /* fill init structure */
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable; /* DMA1 Channel5 (triggered by USART3 Tx event) Config */
DMA_DeInit(UART3_TX_DMA);
DMA_InitStructure.DMA_PeripheralBaseAddr = USART3_DR_Base;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
/* As we will set them before DMA actually enabled, the DMA_MemoryBaseAddr
* and DMA_BufferSize are meaningless. So just set them to proper values
* which could make DMA_Init happy.
*/
DMA_InitStructure.DMA_MemoryBaseAddr = (u32);
DMA_InitStructure.DMA_BufferSize = ;
DMA_Init(UART3_TX_DMA, &DMA_InitStructure);
DMA_ITConfig(UART3_TX_DMA, DMA_IT_TC | DMA_IT_TE, ENABLE);
DMA_ClearFlag(DMA1_FLAG_TC2);
#endif
} /***********************************************************************************************************
@ model driven architecture interface
@____________________________________________________________________________*/
rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg); int serial_put_char(struct rt_serial_device *serial, char c)
{
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); USART_ClearFlag(user->uart_device,USART_FLAG_TC);
USART_SendData(user->uart_device, c);
while (USART_GetFlagStatus(user->uart_device, USART_FLAG_TC) == RESET); return c;
} int serial_get_char(struct rt_serial_device *serial)
{
int ch = -;
struct serial_user_data* user = (struct serial_user_data *)(serial->parent.user_data); if(USART_GetITStatus(user->uart_device, USART_IT_RXNE) != RESET)
{
/* interrupt mode receive */
RT_ASSERT(serial->parent.flag & RT_DEVICE_FLAG_INT_RX); ch = USART_ReceiveData(user->uart_device); /* clear interrupt */
USART_ClearITPendingBit(user->uart_device, USART_IT_RXNE);
}
return ch;
} rt_err_t serial_control(struct rt_serial_device *serial, int cmd, void *arg)
{
FunctionalState NewState; struct serial_user_data *user = (struct serial_user_data *)serial->parent.user_data; switch(cmd)
{
case RT_DEVICE_CTRL_SET_INT:
{
NewState = ENABLE;
break;
}
case RT_DEVICE_CTRL_CLR_INT:
{
NewState = DISABLE;
break;
}
default:
{
break;
}
} switch(*(rt_uint32_t *)arg)
{
case RT_SERIAL_RX_INT:
{
USART_ITConfig(user->uart_device, USART_IT_RXNE, NewState);
break;
}
case RT_SERIAL_TX_INT:
{
USART_ITConfig(user->uart_device, USART_IT_TC, NewState);
break;
}
default :
{
break;
}
} return RT_EOK;
} rt_size_t serial_dma_transmit(struct rt_serial_device *serial, const char *buf, rt_size_t size)
{
return size;
} rt_err_t stm32_serial_config(struct rt_serial_device *serial, struct serial_configure *cfg)
{
USART_InitTypeDef USART_InitStructure;
USART_ClockInitTypeDef USART_ClockInitStructure;
struct serial_user_data* user = (struct serial_user_data *)serial->parent.user_data; RCC_Configuration();
GPIO_Configuration();
NVIC_Configuration();
DMA_Configuration(); USART_InitStructure.USART_BaudRate = cfg->baud_rate; switch(cfg->data_bits)
{
case :
{
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
break;
}
case :
{
USART_InitStructure.USART_WordLength = USART_WordLength_9b;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("data bit set error\n");
#endif
break;
}
} switch(cfg->stop_bits)
{
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_1;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_2;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_0_5;
break;
}
case :
{
USART_InitStructure.USART_StopBits = USART_StopBits_1_5;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("stopbits bit set error\n");
#endif
break;
}
} switch(cfg->parity)
{
case :
{
USART_InitStructure.USART_Parity = USART_Parity_No;
break;
}
case :
{
USART_InitStructure.USART_Parity = USART_Parity_Odd;
break;
}
case :
{
USART_InitStructure.USART_Parity = USART_Parity_Even;
break;
}
default :
{
#ifndef RT_USING_FINSH
rt_kprintf("data bit set error\n");
#endif
break;
}
} USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;
USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;
USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;
USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; USART_Init(user->uart_device, &USART_InitStructure);
USART_ClockInit(user->uart_device, &USART_ClockInitStructure); /* enable interrupt */
USART_ITConfig(user->uart_device, USART_IT_RXNE, ENABLE); return RT_EOK;
} /***********************************************************************************************************
@serial private function
@____________________________________________________________________________*/
struct rt_uart_ops serial_ops =
{
stm32_serial_config,
serial_control,
serial_put_char,
serial_get_char,
serial_dma_transmit
};
/***********************************************************************************************************
@Struct declaration
@____________________________________________________________________________*/
struct serial_configure serial_config =
{
, //USART_BaudRate
, //USART_WordLength
, //USART_StopBits
, //USART_Parity
, //
, //
//
};
struct serial_user_data serial_user_struct =
{
USART2, //hardware device
"uart2" //device name
};
struct serial_ringbuffer serial_int_rx_buffer;
struct serial_ringbuffer serial_int_tx_buffer;
struct rt_serial_device serialx_device; void rt_hw_serialx_register(void)
{
serialx_device.config = serial_config;
serialx_device.int_rx = &serial_int_rx_buffer;
serialx_device.int_tx = &serial_int_tx_buffer;
serialx_device.ops = &serial_ops; rt_hw_serial_register(&serialx_device, serial_user_struct.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct);
} struct serial_user_data serial_user_struct1 =
{
USART1, //hardware device
"uart1" //device name
};
struct rt_serial_device serialx_device1;
struct serial_ringbuffer serial_int_rx_buffer1;
struct serial_ringbuffer serial_int_tx_buffer1;
void rt_hw_serialx_register1(void)
{
serialx_device1.config = serial_config;
serialx_device1.int_rx = &serial_int_rx_buffer1;
serialx_device1.int_tx = &serial_int_tx_buffer1;
serialx_device1.ops = &serial_ops; rt_hw_serial_register(&serialx_device1, serial_user_struct1.name,
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM,
&serial_user_struct1);
} #ifdef RT_USING_FINSH
#include <finsh.h>
static rt_uint8_t led_inited = ;
void usarts2(char *str)
{
rt_device_t usart; usart = rt_device_find("uart2");
rt_device_write(usart,,str,);
}
FINSH_FUNCTION_EXPORT(usarts2,str)
#endif

STM32_杂_01_串口代码的更多相关文章

  1. 没有真实串口设备时使用"虚拟串口驱动"调试你的串口代码

    目录 前言 示例代码 总结 前言 很多时候需要编写串口代码,但是又没有真实串口设备来调试代码.以及本身就是要操作2个串口的情况,可以使用"虚拟串口驱动"工具方便的调试代码. 使用方 ...

  2. 低功耗蓝牙4.0BLE编程-nrf51822开发(11)-蓝牙串口代码分析

    代码实例:点击打开链接 实现的功能是从uart口发送数据至另一个蓝牙串口,或是从蓝牙读取数据通过uart打印出数据. int main(void) { // Initialize leds_init( ...

  3. u-boot移植(六)---代码修改---串口

    一.代码流程 1.1 串口代码 程序流程图如下: default_serial_console 执行的代码如下: 在JZ2440.H中有如下定义: 则执行结构体s3c24xx_serial0_devi ...

  4. linux串口编程(c)

    //linux c: 串口设置//串口操作无非以下几个://1 打开                       //2 设置串口属性//3 read write //struct termios能够 ...

  5. ASP.NET\MVC 解决C#上传图片质量下降,图片模糊,水印有杂点的问题

    对图片处理这一块不是很懂,自己写不出来,这些年一直没有停止找一个上传图片质量不下降,加水印不会导致模糊和水印周边产生杂点的代码. 网上基本上99.9%的代码处理图片质量都是下面这两句: //设置质量 ...

  6. Android串口通讯

    今天在整一个项目,需要利用串口通讯在网上看了好多人的帖子才稍微整出了一点头绪. 首先串口代码就是利用谷歌自己的api,将java代码放在java/android_serialport_api目录下,如 ...

  7. 【接口时序】3、UART串口收发的原理与Verilog实现

    一.软件平台与硬件平台 软件平台: 1.操作系统:Windows-8.1 2.开发套件:ISE14.7 3.仿真工具:ModelSim-10.4-SE 硬件平台: 1.FPGA型号:XC6SLX45- ...

  8. ubuntu下irobot串口通讯

    在window下以前就`有一个现成的串口代码.想移植到ubuntu下,发现都不一样了.要重新找个. 折腾了一上午之后,发现自己写这个串口通讯还是有一点难度. 于是,用了github上 Erick Co ...

  9. 【转】如何在VC下检测当前存在的串口及串口热拔插

    当我们在用VS进行串口编程时,在打开串口前,经常想知道当前PC上存在多少个串口,哪些串口可用?哪些串口已经打开了,最好是在一个Combo Box中列表系统当前所有可用的串口以供选择,然而如何获取系统当 ...

随机推荐

  1. Android测试(三)——APK文件反编译

    APK文件反编译: 在进行反编译操作前,先简单介绍下smali文件: smali是一种文件格式,语法和Jasmine的语言类似,这些smali文件包含开发应用程序时编写的java类的代码. 工具:ja ...

  2. PostgreSQL work_mem理解

    官方说法: work_mem (integer) Specifies the amount of memory to be used by internal sort operations and h ...

  3. Php的基本语法学习

    1.php语法 当 PHP 解析一个文件时,会寻找开始和结束标记,标记告诉 PHP 开始和停止解释其中的代码. 1)标记语法 是以<?php 开头,?> 结束,相当于html标签的开始标签 ...

  4. python 爬虫 记录

    python3 爬虫需要安装:requests,beautifulsoup4,html5lib 带有中文的需要这样写,要不然就会出现乱码 html = response.content.decode( ...

  5. 跟随我在oracle学习php(5)

    框架(把一个页面引入当前页面 易维护 扩展 复用)<iframe src=”” frameborder=“”> 格式:iframe <frameset> <frame&g ...

  6. spring boot 添加客户端负载均衡

    1.pom.xml文件中,添加依赖包 <dependency> <groupId>org.springframework.cloud</groupId> <a ...

  7. Python中异常处理

    高级语言通常都配置了一套try...except...finally的错误处理机制. 1.我们先看一个try的机制 try: res=1/0except ZeroDivisionError as e: ...

  8. wpf UI 元素类型

  9. element ui表格相同内容自动合并

    一开始觉得合并单元格很困难,什么鬼,后来仔细查看api,发现是可以实现的,特此记录下,直接看代码, 项目需求是第一列和第二列还有第16列需要相同内容进行合并,所以判断条件是不同的: 实现后效果如下: ...

  10. Power BI Desktop 新年快乐!

    新年快乐 2018年是Power BI 多产的一年!更新发布的功能就超过150多个,真是相当的强大! 为了庆祝这一成功的一年,Power BI官方团队制作了一个有趣的视频,展示他们对2018年最喜欢的 ...