NOTICE توجه: این یک موضوع قدیمی است که آخرین پست ارسالی آن مربوط به 1081 روز قبل است . لطفا فقط پاسخ ها ، سوالات و درخواست های 100 درصد مرتبط را به آن ارسال کنید و برای درخواست ها و سوالات جدید موضوع جدیدی را ایجاد کنید
صفحه 6 از 6 نخستنخست 123456
نمایش نتایج: از 101 به 114 از 114

موضوع: فیلم آموزش STM32F10x (مقدماتی و متوسط)

  1. #101

  2. # ADS
    Circuit advertisement
    تاریخ عضویت
    Always
    نام
    Advertising world
    نوشته ها
    Many
     

  3. #102
    عضو جدید
    تاریخ عضویت
    Jan 2014
    نوشته ها
    5
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    مهندس جان سلام وقت بخیر.برای برنامه نویسی به روش فقط رجیستری با keil5 نمیشود پروژه ساخت و برنامه بنویسیم؟وباید حتما باید با keil4بنویسیم؟من میخوام رجیستری کد بنویسم
    تشکر

  4. #103
    مدیر انجمن mzarkoob آواتار ها
    تاریخ عضویت
    Jun 2011
    نام
    مهدی زرکوب
    نوشته ها
    2,902
    تشکر
    1,202
    تشکر شده 2,317 بار در 1,273 پست

    پیش فرض

    نقل قول نوشته اصلی توسط 91154 نمایش پست ها
    مهندس جان سلام وقت بخیر.برای برنامه نویسی به روش فقط رجیستری با keil5 نمیشود پروژه ساخت و برنامه بنویسیم؟وباید حتما باید با keil4بنویسیم؟من میخوام رجیستری کد بنویسم
    تشکر
    فرقی نداره! شما اگر نیاز پیدا کردید رجیستری کار کنید چه با کیل 4 چه با کیل 5 چه با کیل 6! هم می توانید کار کنید.

  5. #104
    عضو جدید
    تاریخ عضویت
    Jan 2014
    نوشته ها
    5
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    چون بخش رجیستری رو خودتون با ورژن4 نوشتید وهمچنین هنگام ساخت فایل پروژه به پوشه هایincو startupمیرید .که این فایل ها در ورژن 5 اصلا وجود ندارد.راهنمایی کنید ممنون میشم

  6. #105

  7. #106
    تازه وارد
    تاریخ عضویت
    Jan 2019
    نوشته ها
    3
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    کد:
    /*----------------------------------------------------------------------------
    * Name: LCD_4bit.c
    * Purpose: low level LDC functions
    * Note(s): 2 line 16 character Text LCD (4-bit interface)
    * connected on MCBSTM32 Evaluation Board
    *----------------------------------------------------------------------------
    * This file is part of the uVision/ARM development tools.
    * This software may only be used under the terms of a valid, current,
    * end user licence from KEIL for a compatible version of KEIL software
    * development tools. Nothing else gives you the right to use this software.
    *
    * This software is supplied "AS IS" without warranties of any kind.
    *
    * Copyright (c) 20009-2011 Keil - An ARM Company. All rights reserved.
    *----------------------------------------------------------------------------*/
    
    
    #include "STM32F10x.h"
    #include "LCD.h"
    
    
    /* 8 user defined characters to be loaded into CGRAM (used for bargraph) */
    const char UserFont[8][8] = {
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
    { 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10 },
    { 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18 },
    { 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C },
    { 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E },
    { 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F },
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
    };
    
    
    
    
    /************************ Global function definitions *************************/
    
    
    
    
    /*******************************************************************************
    * Delay in while loop cycles *
    * Parameter: cnt: number of while cycles to delay *
    * Return: *
    *******************************************************************************/
    
    
    static void delay (int cnt)// us
    {
    uint32_t i;
    
    i = 0;
    while (cnt--) {
    for (i = 0; i < DELAY; i++);
    }
    }
    
    
    
    
    /*******************************************************************************
    * Read status of LCD controller *
    * Parameter: none *
    * Return: Status byte contains busy flag and address pointer *
    *******************************************************************************/
    
    
    static unsigned char lcd_read_status (void)
    {
    unsigned char status;
    
    
    LCD_DATA_DIR_IN
    LCD_RS(0)
    LCD_RW(1)
    delay(1);
    LCD_E(1)
    delay(1);
    status = LCD_DATA_IN << 4;
    LCD_E(0)
    delay(1);
    LCD_E(1)
    delay(1);
    status |= LCD_DATA_IN;
    LCD_E(0)
    LCD_DATA_DIR_OUT
    return (status);
    }
    
    
    
    
    /*******************************************************************************
    * Wait until LCD controller busy flag is 0 *
    * Parameter: *
    * Return: Status byte of LCD controller (busy + address) *
    *******************************************************************************/
    
    
    static unsigned char wait_while_busy (void)
    {
    unsigned char status;
    
    
    do {
    status = lcd_read_status();
    } while (status & 0x80); /* Wait for busy flag */
    
    
    return (status);
    }
    
    
    
    
    /*******************************************************************************
    * Write 4-bits to LCD controller *
    * Parameter: c: command to be written *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_write_4bit (unsigned char c)
    {
    LCD_RW(0)
        LCD_DATA_OUT(c)
        LCD_E(1)
    delay(1);
    LCD_E(0)
    delay(800);
        LCD_CLR_OUT(x)
    }
    
    
    
    
    /*******************************************************************************
    * Write command to LCD controller *
    * Parameter: c: command to be written *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_write_cmd (unsigned char c)
    {
    wait_while_busy();
    
    
    LCD_RS(0)
    lcd_write_4bit (c>>4);
    lcd_write_4bit (c);
    }
    
    
    
    
    /*******************************************************************************
    * Write data to LCD controller *
    * Parameter: c: data to be written *
    * Return: *
    *******************************************************************************/
    
    
    static void lcd_write_data (unsigned char c)
    {
    wait_while_busy();
    
    
    LCD_RS(1)
    lcd_write_4bit (c>>4);
    lcd_write_4bit (c);
    }
    
    
    
    
    /*******************************************************************************
    * Print Character to current cursor position *
    * Parameter: c: character to be printed *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_putchar (char c)
    { 
    lcd_write_data (c);
    }
    
    
    
    
    /*******************************************************************************
    * Initialize the LCD controller *
    * Parameter: *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_init (void)
    { 
    int i;
    char const *p;
    
    
    //LCD_CLOCKA_EN /* Enable clock for peripheral */
    LCD_CLOCKB_EN 
    /* Set all pins for LCD as outputs */
    LCD_ALL_DIR_OUT1
        LCD_ALL_DIR_OUT2
        
    delay (1500);
    LCD_RS(0)
    lcd_write_4bit (0x3); /* Select 4-bit interface */
    lcd_write_4bit (0x3);
    lcd_write_4bit (0x3);
    lcd_write_4bit (0x2);
    
    
    lcd_write_cmd (0x28); /* 2 lines, 5x8 character matrix */
    lcd_write_cmd (0x0C); /* Display ctrl:Disp=ON,Curs/Blnk=OFF */
    lcd_write_cmd (0x06); /* Entry mode: Move right, no shift */
    
    
    /* Load user-specific characters into CGRAM */
    lcd_write_cmd(0x40); /* Set CGRAM address counter to 0 */
    p = &UserFont[0][0];
    for (i = 0; i < sizeof(UserFont); i++, p++)
    lcd_putchar (*p);
    
    
    lcd_write_cmd(0x80); /* Set DDRAM address counter to 0 */
    }
    
    
    
    
    
    
    /*******************************************************************************
    * Set cursor position on LCD display *
    * Parameter: column: column position *
    * line: line position *
    * Return: *
    *******************************************************************************/
    
    
    void set_cursor (int column, int line)
    {
    unsigned char address;
    
    
    address = (line * 40) + column;
    address = 0x80 + (address & 0x7F);
    lcd_write_cmd(address); /* Set DDRAM address counter to 0 */
    }
    
    
    /*******************************************************************************
    * Clear the LCD display *
    * Parameter: *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_clear (void)
    {
    lcd_write_cmd(0x01); /* Display clear */
    set_cursor (0, 0);
    }
    
    
    
    
    /*******************************************************************************
    * Print sting to LCD display *
    * Parameter: string: pointer to output string *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_print (char *string)
    {
    while (*string) {
    lcd_putchar (*string++);
    }
    }
    
    
    
    
    /*******************************************************************************
    * Print a bargraph to LCD display *
    * Parameter: val: value 0..100 % *
    * size: size of bargraph 1..16 *
    * Return: *
    *******************************************************************************/
    void lcd_bargraph (int value, int size) {
    int i;
    
    
    value = value * size / 20; /* Display matrix 5 x 8 pixels */
    for (i = 0; i < size; i++) {
    if (value > 5) {
    lcd_putchar (0x05);
    value -= 5;
    }
    else {
    lcd_putchar (value);
    break;
    }
    }
    }
    
    
    
    
    /*******************************************************************************
    * Display bargraph on LCD display *
    * Parameter: pos_x: horizontal position of bargraph start *
    * pos_y: vertical position of bargraph *
    * value: size of bargraph active field (in pixels) *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_bargraphXY (int pos_x, int pos_y, int value) {
    int i;
    
    
    set_cursor (pos_x, pos_y);
    for (i = 0; i < 16; i++) {
    if (value > 5) {
    lcd_putchar (0x05);
    value -= 5;
    } else {
    lcd_putchar (value);
    while (i++ < 16) lcd_putchar (0);
    }
    }
    }
    
    
    /******************************************************************************/
    این کتابخونه تغییر دادم برای برد خودم..برا lcdولی کار نمیکنه.....اتصالاتم مثل همین ک مشخص کردم بستم....هدر رد stm32f103cاستفاده میکنم
    لطفعا کمک کنین
    
    - - - Updated - - -
    
    
    
    
    /*------------------------- Speed dependant settings -------------------------*/
    
    
    #define DELAY 20
    /*------------------------- Text LCD size definitions ------------------------*/
    #define LineLen 16 /* Width (in characters) */
    #define NumLines 2 /* Hight (in lines) */
    /*-------------------- LCD interface hardware definitions --------------------*/
    /* PINS: 
    - DB4 = PB12
    - DB5 = PB13
    - DB6 = PB14
    - DB7 = PB15
    
    
    - RS = PB9
    - RW = PB10     
    - E = PB11
    */
    #define DB4 12
    #define PIN_RS (1<<9) //PB.9
    #define PIN_RW (1<<10) //PB.10
    #define PIN_E (1<<11) //PB.11
    
    
    #define GPIO_Data GPIOB
    #define GPIO_CTRL GPIOB
    #define PINS_DATA (0x0F << DB4)
    
    
    /* Enable Clock for peripheral driving LCD pins */
    #define LCD_CLOCKB_EN RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; // enable clock for GPIOB
    //#define LCD_CLOCKB_EN RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; // enable clock for GPIOC 
    
    
    /* pin RS setting to 0 or 1 */
    #define LCD_RS(x) (x ? (GPIO_CTRL->BSRR = PIN_RS) : (GPIO_CTRL->BRR = PIN_RS));
    
    
    /* pin RW setting to 0 or 1 */
    #define LCD_RW(x) (x ? (GPIO_CTRL->BSRR = PIN_RW) : (GPIO_CTRL->BRR = PIN_RW));
    
    
    /* pin E setting to 0 or 1 */
    #define LCD_E(x) (x ? (GPIO_CTRL->BSRR = PIN_E) : (GPIO_CTRL->BRR = PIN_E));
    
    
    /* Reading DATA pins */
    #define LCD_DATA_IN ((GPIO_Data->IDR & PINS_DATA) >> DB4) & 0x0F
    
    
    /* Writing value to DATA pins */
    #define LCD_CLR_OUT(x) GPIO_Data->BRR = 0xF << DB4; 
    #define LCD_DATA_OUT(x) GPIO_Data->BSRR = (x&0x0f) << DB4;
    
    
    /* Setting all pins to output mode */
    #define LCD_ALL_DIR_OUT1 GPIO_Data->CRH &= ~0xFFFF0000;\
    GPIO_Data->CRH |= 0x33330000;
                                                             
    #define LCD_ALL_DIR_OUT2 GPIO_CTRL->CRH &= ~0x0000FFF0;\
    GPIO_CTRL->CRH |= 0x00003330; 
    
    
    /* Setting DATA pins to input mode */
    #define LCD_DATA_DIR_IN GPIO_Data->CRH = (GPIO_Data->CRH & 0xFFFF0000) | 0x44440000;
    
    
    /* Setting DATA pins to output mode */
    #define LCD_DATA_DIR_OUT GPIO_Data->CRH &= ~0xFFFF0000;\
    GPIO_Data->CRH |= 0x33330000;
    
    
    extern void lcd_init (void);
    extern void lcd_clear (void);
    extern void lcd_putchar (char c);
    extern void set_cursor (int column, int line);
    extern void lcd_print (char *string);
    extern void lcd_bargraph (int value, int size);
    extern void lcd_bargraphXY (int pos_x, int pos_y, int value);
    void lcd_write_cmd (unsigned char c);
    
    
    /******************************************************************************/
    ویرایش توسط mzarkoob : 08-05-2019 در ساعت 17:28 دلیل: اصلاح کد

  8. #107
    تازه وارد
    تاریخ عضویت
    May 2019
    نوشته ها
    1
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    سلام من میخوام‌ از Adc با سرعت ۵۰۰۰ نمونه در ثانیه نمونه گیری کنم چطور میتونم این کار کنم و تنظیماتم باید به چه شکل باشه .. ممنون

  9. #108
    مدیر انجمن mzarkoob آواتار ها
    تاریخ عضویت
    Jun 2011
    نام
    مهدی زرکوب
    نوشته ها
    2,902
    تشکر
    1,202
    تشکر شده 2,317 بار در 1,273 پست

    پیش فرض

    نقل قول نوشته اصلی توسط OMID.RE نمایش پست ها
    کد:
    /*----------------------------------------------------------------------------
    * Name: LCD_4bit.c
    * Purpose: low level LDC functions
    * Note(s): 2 line 16 character Text LCD (4-bit interface)
    * connected on MCBSTM32 Evaluation Board
    *----------------------------------------------------------------------------
    * This file is part of the uVision/ARM development tools.
    * This software may only be used under the terms of a valid, current,
    * end user licence from KEIL for a compatible version of KEIL software
    * development tools. Nothing else gives you the right to use this software.
    *
    * This software is supplied "AS IS" without warranties of any kind.
    *
    * Copyright (c) 20009-2011 Keil - An ARM Company. All rights reserved.
    *----------------------------------------------------------------------------*/
    
    
    #include "STM32F10x.h"
    #include "LCD.h"
    
    
    /* 8 user defined characters to be loaded into CGRAM (used for bargraph) */
    const char UserFont[8][8] = {
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
    { 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10 },
    { 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18 },
    { 0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C },
    { 0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E,0x1E },
    { 0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F },
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }
    };
    
    
    
    
    /************************ Global function definitions *************************/
    
    
    
    
    /*******************************************************************************
    * Delay in while loop cycles *
    * Parameter: cnt: number of while cycles to delay *
    * Return: *
    *******************************************************************************/
    
    
    static void delay (int cnt)// us
    {
    uint32_t i;
    
    i = 0;
    while (cnt--) {
    for (i = 0; i < DELAY; i++);
    }
    }
    
    
    
    
    /*******************************************************************************
    * Read status of LCD controller *
    * Parameter: none *
    * Return: Status byte contains busy flag and address pointer *
    *******************************************************************************/
    
    
    static unsigned char lcd_read_status (void)
    {
    unsigned char status;
    
    
    LCD_DATA_DIR_IN
    LCD_RS(0)
    LCD_RW(1)
    delay(1);
    LCD_E(1)
    delay(1);
    status = LCD_DATA_IN << 4;
    LCD_E(0)
    delay(1);
    LCD_E(1)
    delay(1);
    status |= LCD_DATA_IN;
    LCD_E(0)
    LCD_DATA_DIR_OUT
    return (status);
    }
    
    
    
    
    /*******************************************************************************
    * Wait until LCD controller busy flag is 0 *
    * Parameter: *
    * Return: Status byte of LCD controller (busy + address) *
    *******************************************************************************/
    
    
    static unsigned char wait_while_busy (void)
    {
    unsigned char status;
    
    
    do {
    status = lcd_read_status();
    } while (status & 0x80); /* Wait for busy flag */
    
    
    return (status);
    }
    
    
    
    
    /*******************************************************************************
    * Write 4-bits to LCD controller *
    * Parameter: c: command to be written *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_write_4bit (unsigned char c)
    {
    LCD_RW(0)
        LCD_DATA_OUT(c)
        LCD_E(1)
    delay(1);
    LCD_E(0)
    delay(800);
        LCD_CLR_OUT(x)
    }
    
    
    
    
    /*******************************************************************************
    * Write command to LCD controller *
    * Parameter: c: command to be written *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_write_cmd (unsigned char c)
    {
    wait_while_busy();
    
    
    LCD_RS(0)
    lcd_write_4bit (c>>4);
    lcd_write_4bit (c);
    }
    
    
    
    
    /*******************************************************************************
    * Write data to LCD controller *
    * Parameter: c: data to be written *
    * Return: *
    *******************************************************************************/
    
    
    static void lcd_write_data (unsigned char c)
    {
    wait_while_busy();
    
    
    LCD_RS(1)
    lcd_write_4bit (c>>4);
    lcd_write_4bit (c);
    }
    
    
    
    
    /*******************************************************************************
    * Print Character to current cursor position *
    * Parameter: c: character to be printed *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_putchar (char c)
    { 
    lcd_write_data (c);
    }
    
    
    
    
    /*******************************************************************************
    * Initialize the LCD controller *
    * Parameter: *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_init (void)
    { 
    int i;
    char const *p;
    
    
    //LCD_CLOCKA_EN /* Enable clock for peripheral */
    LCD_CLOCKB_EN 
    /* Set all pins for LCD as outputs */
    LCD_ALL_DIR_OUT1
        LCD_ALL_DIR_OUT2
        
    delay (1500);
    LCD_RS(0)
    lcd_write_4bit (0x3); /* Select 4-bit interface */
    lcd_write_4bit (0x3);
    lcd_write_4bit (0x3);
    lcd_write_4bit (0x2);
    
    
    lcd_write_cmd (0x28); /* 2 lines, 5x8 character matrix */
    lcd_write_cmd (0x0C); /* Display ctrl:Disp=ON,Curs/Blnk=OFF */
    lcd_write_cmd (0x06); /* Entry mode: Move right, no shift */
    
    
    /* Load user-specific characters into CGRAM */
    lcd_write_cmd(0x40); /* Set CGRAM address counter to 0 */
    p = &UserFont[0][0];
    for (i = 0; i < sizeof(UserFont); i++, p++)
    lcd_putchar (*p);
    
    
    lcd_write_cmd(0x80); /* Set DDRAM address counter to 0 */
    }
    
    
    
    
    
    
    /*******************************************************************************
    * Set cursor position on LCD display *
    * Parameter: column: column position *
    * line: line position *
    * Return: *
    *******************************************************************************/
    
    
    void set_cursor (int column, int line)
    {
    unsigned char address;
    
    
    address = (line * 40) + column;
    address = 0x80 + (address & 0x7F);
    lcd_write_cmd(address); /* Set DDRAM address counter to 0 */
    }
    
    
    /*******************************************************************************
    * Clear the LCD display *
    * Parameter: *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_clear (void)
    {
    lcd_write_cmd(0x01); /* Display clear */
    set_cursor (0, 0);
    }
    
    
    
    
    /*******************************************************************************
    * Print sting to LCD display *
    * Parameter: string: pointer to output string *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_print (char *string)
    {
    while (*string) {
    lcd_putchar (*string++);
    }
    }
    
    
    
    
    /*******************************************************************************
    * Print a bargraph to LCD display *
    * Parameter: val: value 0..100 % *
    * size: size of bargraph 1..16 *
    * Return: *
    *******************************************************************************/
    void lcd_bargraph (int value, int size) {
    int i;
    
    
    value = value * size / 20; /* Display matrix 5 x 8 pixels */
    for (i = 0; i < size; i++) {
    if (value > 5) {
    lcd_putchar (0x05);
    value -= 5;
    }
    else {
    lcd_putchar (value);
    break;
    }
    }
    }
    
    
    
    
    /*******************************************************************************
    * Display bargraph on LCD display *
    * Parameter: pos_x: horizontal position of bargraph start *
    * pos_y: vertical position of bargraph *
    * value: size of bargraph active field (in pixels) *
    * Return: *
    *******************************************************************************/
    
    
    void lcd_bargraphXY (int pos_x, int pos_y, int value) {
    int i;
    
    
    set_cursor (pos_x, pos_y);
    for (i = 0; i < 16; i++) {
    if (value > 5) {
    lcd_putchar (0x05);
    value -= 5;
    } else {
    lcd_putchar (value);
    while (i++ < 16) lcd_putchar (0);
    }
    }
    }
    
    
    /******************************************************************************/
    این کتابخونه تغییر دادم برای برد خودم..برا lcdولی کار نمیکنه.....اتصالاتم مثل همین ک مشخص کردم بستم....هدر رد stm32f103cاستفاده میکنم
    لطفعا کمک کنین
    
    - - - Updated - - -
    
    
    
    
    /*------------------------- Speed dependant settings -------------------------*/
    
    
    #define DELAY 20
    /*------------------------- Text LCD size definitions ------------------------*/
    #define LineLen 16 /* Width (in characters) */
    #define NumLines 2 /* Hight (in lines) */
    /*-------------------- LCD interface hardware definitions --------------------*/
    /* PINS: 
    - DB4 = PB12
    - DB5 = PB13
    - DB6 = PB14
    - DB7 = PB15
    
    
    - RS = PB9
    - RW = PB10     
    - E = PB11
    */
    #define DB4 12
    #define PIN_RS (1<<9) //PB.9
    #define PIN_RW (1<<10) //PB.10
    #define PIN_E (1<<11) //PB.11
    
    
    #define GPIO_Data GPIOB
    #define GPIO_CTRL GPIOB
    #define PINS_DATA (0x0F << DB4)
    
    
    /* Enable Clock for peripheral driving LCD pins */
    #define LCD_CLOCKB_EN RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; // enable clock for GPIOB
    //#define LCD_CLOCKB_EN RCC->APB2ENR |= RCC_APB2ENR_IOPBEN; // enable clock for GPIOC 
    
    
    /* pin RS setting to 0 or 1 */
    #define LCD_RS(x) (x ? (GPIO_CTRL->BSRR = PIN_RS) : (GPIO_CTRL->BRR = PIN_RS));
    
    
    /* pin RW setting to 0 or 1 */
    #define LCD_RW(x) (x ? (GPIO_CTRL->BSRR = PIN_RW) : (GPIO_CTRL->BRR = PIN_RW));
    
    
    /* pin E setting to 0 or 1 */
    #define LCD_E(x) (x ? (GPIO_CTRL->BSRR = PIN_E) : (GPIO_CTRL->BRR = PIN_E));
    
    
    /* Reading DATA pins */
    #define LCD_DATA_IN ((GPIO_Data->IDR & PINS_DATA) >> DB4) & 0x0F
    
    
    /* Writing value to DATA pins */
    #define LCD_CLR_OUT(x) GPIO_Data->BRR = 0xF << DB4; 
    #define LCD_DATA_OUT(x) GPIO_Data->BSRR = (x&0x0f) << DB4;
    
    
    /* Setting all pins to output mode */
    #define LCD_ALL_DIR_OUT1 GPIO_Data->CRH &= ~0xFFFF0000;\
    GPIO_Data->CRH |= 0x33330000;
                                                             
    #define LCD_ALL_DIR_OUT2 GPIO_CTRL->CRH &= ~0x0000FFF0;\
    GPIO_CTRL->CRH |= 0x00003330; 
    
    
    /* Setting DATA pins to input mode */
    #define LCD_DATA_DIR_IN GPIO_Data->CRH = (GPIO_Data->CRH & 0xFFFF0000) | 0x44440000;
    
    
    /* Setting DATA pins to output mode */
    #define LCD_DATA_DIR_OUT GPIO_Data->CRH &= ~0xFFFF0000;\
    GPIO_Data->CRH |= 0x33330000;
    
    
    extern void lcd_init (void);
    extern void lcd_clear (void);
    extern void lcd_putchar (char c);
    extern void set_cursor (int column, int line);
    extern void lcd_print (char *string);
    extern void lcd_bargraph (int value, int size);
    extern void lcd_bargraphXY (int pos_x, int pos_y, int value);
    void lcd_write_cmd (unsigned char c);
    
    
    /******************************************************************************/
    این قسمت از ال سی دی چیه گذاشتید اینجا!؟
    سوالی دارید؟

    - - - Updated - - -

    نقل قول نوشته اصلی توسط moj.ela نمایش پست ها
    سلام من میخوام‌ از Adc با سرعت ۵۰۰۰ نمونه در ثانیه نمونه گیری کنم چطور میتونم این کار کنم و تنظیماتم باید به چه شکل باشه .. ممنون
    اول باید ببینید این میکرو تا چه سرعتی میتونه نمونه گیری کنه
    و بعد برای سرعت حداکثر بایستی از مد scan همراه DMA استفاده کنید.

  10. #109
    عضو جدید
    تاریخ عضویت
    Nov 2017
    نوشته ها
    18
    تشکر
    1
    تشکر شده 0 بار در 0 پست

    پیش فرض

    با سلام و تشکر از زحماتتون مهندسزرکوب عزیز ببخشید ی سوال داشتم خدمتتون درتوضیحاتی که در قسمت نوشتن تابع lcd کاررکتری دادین ببخشید مهندس جان




    int main(void)
    {
    unsigned int s;
    char p[100];
    SysTick_Config((72000000/1000)*1 - 1);

    //LCD_4 BIT MODE
    lcd_init_4bit();
    lcd_puts("TEST CLCD,STM32");
    //X_Y CONFIG X=0;Y=1
    command(0xC0);
    //SEND TO LCD
    lcd_puts("MZarkoob");
    Delay(2000);
    while(1){
    // command(0x01); //LCD CLEAR
    // command(0x80); //X_Y CONFIG satr 1
    for (s=0;s<=10000;s++){
    sprintf(p," %i",s);
    // command(0x01); //LCD CLEAR
    command(0xC9);
    lcd_puts(p);
    Delay(1000);
    }
    }



    SysTick_Config((72000000/1000)*1 - 1); با این تعریف الان مقدار فرکانس کاری میکرو برابر 72000 هستش ؟ و سوال دوم مهندس جان ببخشید



    (void delay_us (uint32_t Time)
    }
    ;uint32_t i

    ; i = 0
    while (Time--) {
    for (i = 0; i < 20; i++);
    }
    {



    ممنون میشم ی توضیح بدین چطور این تابع بر حسب usمیکروثانیه عمل می کنه؟





  11. #110
    تازه وارد
    تاریخ عضویت
    Nov 2013
    نوشته ها
    2
    تشکر
    1
    تشکر شده 0 بار در 0 پست

    پیش فرض

    سلام خسته نباشيد
    مثال هاي فيلم آموزشي مقدماتي و متوسط رو ، روي برد آموزشي stm107 هم ميشه تست كرد؟

  12. #111
    تازه وارد
    تاریخ عضویت
    Jun 2016
    نوشته ها
    1
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    سلام
    *** error 65: access violation at 0x0000000C : no 'read' permission
    این خطا موقع اجرای simulator پیش میاد چگونه مشکل حل کنم
    ایا برای اجرای شبیه ساز نیاز به اتصال ایسی به کامپیوتر هست؟

  13. #112
    تازه وارد
    تاریخ عضویت
    Feb 2009
    نوشته ها
    3
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    با سلام من فیلم آموزش مقدماتی رو تهیه کردم و دارم کار می کنم یه سوال داشتم که با توابع HAL و نرم افزار cubmx کار کنیم بهتره یا با توایع cmsis . یا اینکه نیازه هست به هر دو مسلط بشین ؟
    من قسمت GPIO رو کامل تماشا کردم جسارتا به نظرم اگر اول در مورد ساختار کلاک میکروstm توضیح می دادید برای کسی که از ابتدا می خواد شروع کنه بهتر بود تا بتونه با دید باز کار کنه و مثالها رو روی برد دیگر یا میکرو دیگر هم اجرا کنه من برد stm32f107vc رو دارم و برای اجرا مثالها روی این باید کلاک رو تنظیم کنم . و توی مثال های gpio در مورد باسهای APB1 و 2 .و اهمیت فعال سازی آنها و رجیستر آن هم توضیحی ندادید. با تشکر
    ویرایش توسط vahid-t : 13-08-2020 در ساعت 14:58

  14. #113
    عضو جدید
    تاریخ عضویت
    Aug 2020
    نوشته ها
    9
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض

    سلام

    جناب زرکوب عزیز من این آموزش رو خریداری کردم. و بسیار عالی هست.

    من در قسمت ال سی دی گرافیکی مشکل دارم.
    من از میکرو stm32f072 استفاده میکنم.
    1-پرت های ال سی دی پشت سر هم نیست.
    2-ریست ال سیدی به میکرو وصل نیست. و به gnd وصل هست.

    من همچنان نتونستم ال سی دی رو راه اندازی کنم.

    یک مثال ندارید در قالب یک پروژه که من فقط مشخصات پایه رو تغییر بدم و ... .

  15. #114
    عضو جدید
    تاریخ عضویت
    Aug 2020
    نوشته ها
    9
    تشکر
    0
    تشکر شده 0 بار در 0 پست

    پیش فرض استفاده از پایه های مختلف برای glcd

    جناب زرکوب من فایل پروژه ال سی دی گرافیکی رو پیدا کردم.

    الان من برد و ... رو کشیدم و آماده هست. فقط از پایه های پشت سر هم استفاده نکردم. و پایه ها متفاوت هستند.

    چطور میتونم تعریف کنم و راه اندازی کنم؟

    خیلی واجب و عجله ای هست.

    ممنون

صفحه 6 از 6 نخستنخست 123456

موضوعات مشابه

  1. آموزش رباتیک مقدماتی برای دانش آموزان
    توسط saeid1989 در انجمن مفاهیم اولیه در رباتیک
    پاسخ: 1
    آخرين نوشته: 11-05-2018, 09:53
  2. stm32f10x_cl.h تفاوتش با Stm32f10x.h
    توسط amiroruji72 در انجمن میکرو کنترلر های 32 بیتی(arm)
    پاسخ: 6
    آخرين نوشته: 10-04-2017, 18:51
  3. پاسخ: 2
    آخرين نوشته: 20-04-2014, 00:14
  4. نحوه راه اندازی sim900 با stm32f10X
    توسط Greatal در انجمن ماژول ها و دستگاه های مخابراتی
    پاسخ: 7
    آخرين نوشته: 06-03-2014, 01:15
  5. آموزش مقدماتی رباتیک در دو بخش مک
    توسط ROBOMAN در انجمن مفاهیم اولیه در رباتیک
    پاسخ: 0
    آخرين نوشته: 05-04-2009, 11:57

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •