Ynt: Baştan Sona STM32F0 Discovery Uygulamaları

Başlatan MrDarK, 09 Nisan 2015, 02:29:35

baran123

03 Mayıs 2015, 22:02:45 #30 Son düzenlenme: 03 Mayıs 2015, 22:27:51 Baran Ekrem
Merhaba arkadaşlar,

Bugün SPI hakkında öğrendiklerimi paylaşacağım. :) Bir aksaklık oldu biraz geciktirdim bu sefer çünkü SPI

öğrenmişken OLED Display çalıştırayım dedim fakat aksaklıklar oldu sağ olsun Fırat ağabey biraz önce bir hatamı

düzeltti :) Bu arada OLED LCD diye de söyleniyor sanırım ama aslında şu şekildeymiş :

LCD  = Liquid Crystal Display(Sıvı Kristal Ekran)
OLED = Organik LED, Display benim gibi karıştırmamakta fayda var :)

SPI bildiğimiz üzere minimum 3 kablolu bir iletişim türüdür.Ama donanımsa olarak CS pini de  bulunuyor.Temelde 4 pin

Eğer tek cihaz var ise CS pini LOW da tutulabilir.Master ve Slave olarak inceleyelim bu örneği.STM32F0 Master, OLED

Display Slave konumunda.

SPI pinleri şu şekildedir :

MOSI = Master Out Slave In (Master çıkış slave giriş, masterdan data gönder slave al) TX
MISO = Master In Slave Out (Master giriş slave çıkış, master al slave gönder) RX gibi düşünülebilir
SCK  = Serial Clock

CS'den 0 seviyesine çekilir.Aktif kullanımı bu. Pull up la high konumundadır.SCK dan clock oluşur. Pinlerin çaışma

şeklini şöyle inceleyebiliriz.

0x85 = 0b 1000 0101 

CS   ----________________________________________-------   

SCK      _|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|__|-|_

MOSI --------____________________-----_____-----_________________________________________

MISO      - Geçersiz---------------------------| - Gelen Data Geçerlidir. ---------------|   

SPI data gönderme algoritması :
0101 0101

1 ise mosı 1
0 ise mosı 0
sck hıgh sonra low ver


Şimdi SPI hazırlama kısmına geçelim.

#include "stm32f0xx_conf.h"
#include "ssd1306.h"
#include "font.h"

int main(void)
{
    
GPIO_InitTypeDef GPIO_InitStructure;
    
SPI_InitTypeDef  SPI_InitStructure;

    
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE);
    
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC,ENABLE);
    
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);

    
GPIO_InitStructure.GPIO_Pin    GPIO_Pin_5 GPIO_Pin_6 GPIO_Pin_7//5 = Sck,6 = mıso, = 7mosı
    
GPIO_InitStructure.GPIO_Mode   GPIO_Mode_AF;// Alternatif func.
    
GPIO_InitStructure.GPIO_Speed  GPIO_Speed_50MHz;
    
GPIO_InitStructure.GPIO_OType  GPIO_OType_PP;
    
GPIO_InitStructure.GPIO_PuPd   GPIO_PuPd_NOPULL;
    
GPIO_Init(GPIOA,&GPIO_InitStructure);

    
GPIO_PinAFConfig(GPIOAGPIO_PinSource5GPIO_AF_0);
    
GPIO_PinAFConfig(GPIOAGPIO_PinSource6GPIO_AF_0); //af modda olduklarını belirtiyoruz.
    
GPIO_PinAFConfig(GPIOAGPIO_PinSource7GPIO_AF_0);

    
SPI_InitStructure.SPI_Direction         SPI_Direction_Tx;// sadece gönder
    
SPI_InitStructure.SPI_Mode              SPI_Mode_Master;//master mod
    
SPI_InitStructure.SPI_DataSize          SPI_DataSize_8b;//datalar 8 bit şeklinde gidecek
    
SPI_InitStructure.SPI_CPOL              SPI_CPOL_High;
    
SPI_InitStructure.SPI_CPHA              SPI_CPHA_1Edge;
    
SPI_InitStructure.SPI_NSS               SPI_NSS_Soft;//yazılımsa ss(CS) chip select = slave select, ss
    
SPI_InitStructure.SPI_BaudRatePrescaler SPI_BaudRatePrescaler_4//spi bölme oranı 4
    
SPI_InitStructure.SPI_FirstBit          SPI_FirstBit_MSB//ilk bit msb tarafından
    
SPI_InitStructure.SPI_CRCPolynomial     7;
    
SPI_Init(SPI1,&SPI_InitStructure); //spi ayarlarını yükle 
    
SPI_Cmd(SPI1,ENABLE);//spi aktif 

    
GPIO_InitStructure.GPIO_Mode   GPIO_Mode_OUT
    
GPIO_InitStructure.GPIO_OType  GPIO_OType_PP;
    
GPIO_InitStructure.GPIO_Pin    GPIO_Pin_0 GPIO_Pin_1;// C0 D/C pini (OLED'e özel) C1 ise CS pini
    
GPIO_InitStructure.GPIO_PuPd   GPIO_PuPd_NOPULL;
    
GPIO_InitStructure.GPIO_Speed GPIO_Speed_50MHz;
    
GPIO_Init(GPIOC,&GPIO_InitStructure);

    
Init_OLED();//

    
Oled_SetFont(Font_6x86832127);

    
Oled_ConstText("  [url=https://www.picproje.org]www.picproje.org[/url]"00);
    
Oled_ConstText("Developer : Mr.EKREM"04);
    
Oled_ConstText("  [url=https://www.picproje.org]www.picproje.org[/url]"07);

    while(
1)
    {

    }
}


ssd1306.c

#include "stm32f0xx_conf.h"

#define LCD_CS_PORT                 GPIOC
#define LCD_CS_PIN                  GPIO_Pin_1
#define LCD_DC_PORT                 GPIOC
#define LCD_DC_PIN                  GPIO_Pin_0

#define PAGE0         0
#define PAGE1         1
#define PAGE2         2
#define PAGE3         3
#define PAGE4         4
#define PAGE5         5
#define PAGE6         6
#define PAGE7         7
#define FRAME_2       7
#define FRAME_3       4
#define FRAME_4       5
#define FRAME_5       0
#define FRAME_25      6
#define FRAME_64      1
#define FRAME_128     2
#define FRAME_256     3

const uint8_t *font, *font2;
uint8_t widthheightminmax;

void Init_OLED(void);
void Activate_Scroll(void);
void Deactivate_Scroll(void);
void Oled_Command(uint8_t cmd);
void Oled_WriteRam(uint8_t dat);
void Oled_Image(const uint8_t *buffer);
void Oled_FillScreen(uint8_t pattern);
void Oled_SetPointer(uint8_t seguint8_t pag);
void Oled_WriteChar(uint8_t cuint8_t seguint8_t pag);
void Oled_Text(char *bufferuint8_t seguint8_t pag);
void Oled_ConstText(const char *bufferuint8_t seguint8_t pag);
void Left_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void Right_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void VerticalLeft_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void VerticalRight_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void Oled_SetFont(const uint8_t *_fontuint8_t _widthuint8_t _heightuint8_t _minuint8_t _max);

void Init_OLED(void)
{
   
Oled_Command(0xAE);
   
Oled_Command(0x81);
   
Oled_Command(0xCF);
   
Oled_Command(0xA4);
   
Oled_Command(0xA6);
   
Oled_Command(0x20);
   
Oled_Command(0x02);
   
Oled_Command(0x00);
   
Oled_Command(0x10);
   
Oled_Command(0xB0);
   
Oled_Command(0x40);
   
Oled_Command(0xA1);
   
Oled_Command(0xA8);
   
Oled_Command(0x3F);
   
Oled_Command(0xC8);
   
Oled_Command(0xD3);
   
Oled_Command(0x00);
   
Oled_Command(0xDA);
   
Oled_Command(0x12);
   
Oled_Command(0xD5);
   
Oled_Command(0x80);
   
Oled_Command(0xD9);
   
Oled_Command(0xF1);
   
Oled_Command(0xDB);
   
Oled_Command(0x40);
   
Oled_Command(0x8D);
   
Oled_Command(0x14);
   
Oled_Command(0xAF);

   
Oled_FillScreen(0x00);
}

void Oled_Command(uint8_t Command)
{
    
GPIO_ResetBits(LCD_DC_PORT,LCD_DC_PIN);
    
GPIO_ResetBits(LCD_CS_PORT,LCD_CS_PIN);

    
SPI_SendData8(SPI1Command);
    while (
SPI1->SR SPI_SR_BSY);

    
GPIO_SetBits(LCD_CS_PORT,LCD_CS_PIN);
}

void Oled_WriteRam(uint8_t Data)
{
    
GPIO_ResetBits(LCD_CS_PORT,LCD_CS_PIN);

    
GPIO_SetBits(LCD_DC_PORT,LCD_DC_PIN);

    
SPI_SendData8(SPI1Data);
    while (
SPI1->SR SPI_SR_BSY);

    
GPIO_SetBits(LCD_CS_PORT,LCD_CS_PIN);
}

void Oled_SetPointer(uint8_t seguint8_t pag)
{
   
uint8_t low_columnhig_column;

   
low_column = (seg 0b00001111);
   
hig_column = (seg 0b11110000)>>4;
   
hig_column hig_column 0b00010000;
   
pag = (pag 0b00000111);
   
pag = (pag 0b10110000);
   
Oled_Command(low_column);
   
Oled_Command(hig_column);
   
Oled_Command(pag);
}

void Oled_SetFont(const uint8_t *_fontuint8_t _widthuint8_t _heightuint8_t _minuint8_t _max)
{
   
font2  _font;
   
width  _width;
   
height _height 8;
   
min    _min;
   
max    _max;
}

void Oled_WriteChar(uint8_t cuint8_t seguint8_t pag)
{
   
uint8_t ijkl;
   
uint8_t x_segy_pag;

   
x_seg seg;
   
y_pag pag;
   
font font2;
   
min;
   
= (width height);

   for(
0kj++)
   {
       for(
0li++)
       {
          
font++;
       }
   }

   for(
0widthi++)
   {
      
y_pag pag;
      for(
0heightj++)
      {
         if(
x_seg 128)
         {
            
Oled_SetPointer(x_segy_pag);
            
Oled_WriteRam(*font);
         }
         
y_pag++;
         
font++;
      }
      
x_seg++;
   }
}

void Oled_ConstText(const char *bufferuint8_t seguint8_t pag)
{
   
uint8_t x_seg seg;

   while(*
buffer)
   {
      
Oled_WriteChar(*bufferx_segpag);
      
x_seg x_seg width;
      
buffer++;
   }
}

void Oled_Text(char *bufferuint8_t seguint8_t pag)
{
   
uint8_t x_seg seg;

   while(*
buffer)
   {
      
Oled_WriteChar(*bufferx_segpag);
      
x_seg x_seg width;
      
buffer++;
   }
}

void Oled_FillScreen(uint8_t pattern)
{
   
unsigned char ij;

   for(
08i++)
   {
      
Oled_SetPointer(0i);
      for(
0128j++)
      {
         
Oled_WriteRam(pattern);
      }
   }
}

void Oled_Image(const uint8_t *buffer)
{
   
unsigned char ij;

   for(
08i++)
   {
      
Oled_SetPointer(0i);
      for(
0128j++)
      {
         
Oled_WriteRam(*buffer);
         
buffer++;
      }
   }
}

void Right_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time)
{
   
Deactivate_Scroll();
   
Oled_Command(0x26);
   
Oled_Command(0x00);
   
Oled_Command(start_page);
   
Oled_Command(set_time);
   
Oled_Command(end_page);
   
Oled_Command(0x00);
   
Oled_Command(0xFF);
   
Activate_Scroll();
}

void Left_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time)
{
   
Deactivate_Scroll();
   
Oled_Command(0x27);
   
Oled_Command(0x00);
   
Oled_Command(start_page);
   
Oled_Command(set_time);
   
Oled_Command(end_page);
   
Oled_Command(0x00);
   
Oled_Command(0xFF);
   
Activate_Scroll();
}

void VerticalRight_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time)
{
   
Deactivate_Scroll();
   
Oled_Command(0x29);
   
Oled_Command(0x00);
   
Oled_Command(start_page);
   
Oled_Command(set_time);
   
Oled_Command(end_page);
   
Oled_Command(0x01);
   
Activate_Scroll();
}

void VerticalLeft_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time)
{
   
Deactivate_Scroll();
   
Oled_Command(0x2A);
   
Oled_Command(0x00);
   
Oled_Command(start_page);
   
Oled_Command(set_time);
   
Oled_Command(end_page);
   
Oled_Command(0x01);
   
Activate_Scroll();
}

void Deactivate_Scroll(void)
{
   
Oled_Command(0x2E);
}

void Activate_Scroll(void)
{
   
Oled_Command(0x2F);
}


ssd1306.h

#ifndef SSD1306_H
#define SSD1306_H

void Init_OLED(void);
void Activate_Scroll(void);
void Deactivate_Scroll(void);
void Oled_Command(uint8_t cmd);
void Oled_WriteRam(uint8_t dat);
void Oled_Image(const uint8_t *buffer);
void Oled_FillScreen(uint8_t pattern);
void Oled_SetPointer(uint8_t seguint8_t pag);
void Oled_WriteChar(uint8_t cuint8_t seguint8_t pag);
void Oled_Text(char *bufferuint8_t seguint8_t pag);
void Oled_ConstText(const char *bufferuint8_t seguint8_t pag);
void Left_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void Right_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void VerticalLeft_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void VerticalRight_HorizontalScroll(uint8_t start_pageuint8_t end_pageuint8_t set_time);
void Oled_SetFont(const uint8_t *_fontuint8_t _widthuint8_t _heightuint8_t _minuint8_t _max);


#endif /* SSD1306_H_INCLUDED */


font.h


#ifndef FONT_H
#define FONT_H

const uint8_t Terminal12x16[2304] = {
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x00// (space)
0x000x000x000x000x000x000x000x000xF80x000xFE0x670xFE0x670xF80x000x000x000x00

0x000x000x000x000x00// !
0x000x000x000x000x000x000x3C0x000x3C0x000x000x000x000x000x3C0x000x3C0x000x00

0x000x000x000x000x00// "
0x000x000x000x040x200x3C0x200x3F0xE00x070xFC0x040x3C0x3C0x200x3F0xE00x070xFC

0x040x3C0x000x200x00// #
0x000x000x000x000xF00x080xF80x190x980x190xFE0x7F0xFE0x7F0x980x190x980x1F0x10

0x0F0x000x000x000x00// $
0x000x000x000x300x380x380x380x1C0x380x0E0x000x070x800x030xC00x010xE00x380x70

0x380x380x380x000x00// %
0x000x000x000x000x000x1F0xB80x3F0xFC0x310xC60x210xE20x370x3E0x1E0x1C0x1C0x00

0x360x000x220x000x00// &
0x000x000x000x000x000x000x000x000x4E0x000x7E0x000x3E0x000x000x000x000x000x00

0x000x000x000x000x00// '
0x000x000x000x000x000x000xE00x070xF80x1F0xFC0x3F0x0E0x700x020x400x020x400x00

0x000x000x000x000x00// (
0x000x000x000x000x000x000x020x400x020x400x0E0x700xFC0x3F0xF80x1F0xE00x070x00

0x000x000x000x000x00// )
0x000x000x000x000x980x0C0xB80x0E0xE00x030xF80x0F0xF80x0F0xE00x030xB80x0E0x98

0x0C0x000x000x000x00// *
0x000x000x000x000x800x010x800x010x800x010xF00x0F0xF00x0F0x800x010x800x010x80

0x010x000x000x000x00// +
0x000x000x000x000x000x000x000x000x000x5C0x000x7C0x000x3C0x000x000x000x000x00

0x000x000x000x000x00// ,
0x000x000x000x000x800x010x800x010x800x010x800x010x800x010x800x010x800x010x80

0x010x000x000x000x00// -
0x000x000x000x000x000x000x000x000x000x380x000x380x000x380x000x000x000x000x00

0x000x000x000x000x00// .
0x000x000x000x180x000x1C0x000x0E0x000x070x800x030xC00x010xE00x000x700x000x38

0x000x1C0x000x000x00// /
0x000x000xF00x0F0xFC0x3F0x0C0x3C0x060x660x060x630x860x610xC60x600x660x600x3C

0x300xFC0x3F0xF00x0F// 0
0x000x000x000x000x180x600x180x600x1C0x600xFE0x7F0xFE0x7F0x000x600x000x600x00

0x600x000x000x000x00// 1
0x000x000x380x600x3C0x700x0E0x780x060x7C0x060x6E0x060x670x860x630xC60x610xEE

0x600x7C0x600x380x60// 2
0x000x000x180x180x1C0x380x0E0x700x860x610x860x610x860x610x860x610x860x610xCE

0x730xFC0x3E0x780x1C// 3
0x000x000x800x070xC00x070xE00x060x700x060x380x060x1C0x060x0E0x060xFE0x7F0xFE

0x7F0x000x060x000x06// 4
0x000x000x7E0x180xFE0x380xC60x700xC60x600xC60x600xC60x600xC60x600xC60x600xC6

0x710x860x3F0x060x1F// 5
0x000x000x800x1F0xE00x3F0xF00x730xB80x610x9C0x610x8E0x610x860x610x860x610x86

0x730x000x3F0x000x1E// 6
0x000x000x060x000x060x000x060x000x060x600x060x780x060x1E0x860x070xE60x010x7E

0x000x1E0x000x060x00// 7
0x000x000x000x1E0x780x3F0xFC0x730xCE0x610x860x610x860x610x860x610xCE0x610xFC

0x730x780x3F0x000x1E// C8
0x000x000x780x000xFC0x000xCE0x610x860x610x860x610x860x710x860x390x860x1D0xCE

0x0F0xFC0x070xF80x01// 9
0x000x000x000x000x000x000x000x000x700x1C0x700x1C0x700x1C0x000x000x000x000x00

0x000x000x000x000x00// :
0x000x000x000x000x000x000x000x000x380x4E0x380x7E0x380x3E0x000x000x000x000x00

0x000x000x000x000x00// ;
0x000x000x000x000x800x010xC00x030xE00x070x700x0E0x380x1C0x1C0x380x0E0x700x06

0x600x000x000x000x00// <
0x000x000x000x000x600x060x600x060x600x060x600x060x600x060x600x060x600x060x60

0x060x600x060x000x00// =
0x000x000x000x000x060x600x0E0x700x1C0x380x380x1C0x700x0E0xE00x070xC00x030x80

0x010x000x000x000x00// >
0x000x000x380x000x3C0x000x0E0x000x060x000x060x6F0x860x6F0xC60x010xEE0x000x7C

0x000x380x000x000x00// ?
0x000x000xF00x1F0xFC0x3F0x0E0x300xE60x670xF60x6F0x360x6C0xF60x6F0xF60x6F0x0E

0x6C0xFC0x070xF00x03// @
0x000x000x000x700x000x7E0xC00x0F0xF80x0D0x3E0x0C0x3E0x0C0xF80x0D0xC00x0F0x00

0x7E0x000x700x000x00// A
0x000x000xFE0x7F0xFE0x7F0x860x610x860x610x860x610x860x610xCE0x610xFC0x730x78

0x3F0x000x1E0x000x00// B
0x000x000xE00x070xF80x1F0x1C0x380x0E0x700x060x600x060x600x060x600x0E0x700x1C

0x380x180x180x000x00// C
0x000x000xFE0x7F0xFE0x7F0x060x600x060x600x060x600x060x600x0E0x700x1C0x380xF8

0x1F0xE00x070x000x00// D
0x000x000xFE0x7F0xFE0x7F0x860x610x860x610x860x610x860x610x860x610x860x610x06

0x600x060x600x000x00// E
0x000x000xFE0x7F0xFE0x7F0x860x010x860x010x860x010x860x010x860x010x860x010x06

0x000x060x000x000x00// F
0x000x000xE00x070xF80x1F0x1C0x380x0E0x700x060x600x860x610x860x610x860x610x8E

0x7F0x8C0x7F0x000x00// G
0x000x000xFE0x7F0xFE0x7F0x800x010x800x010x800x010x800x010x800x010x800x010xFE

0x7F0xFE0x7F0x000x00// H
0x000x000x000x000x000x000x060x600x060x600xFE0x7F0xFE0x7F0x060x600x060x600x00

0x000x000x000x000x00// I
0x000x000x000x1C0x000x3C0x000x700x000x600x000x600x000x600x000x600x000x700xFE

0x3F0xFE0x0F0x000x00// J
0x000x000xFE0x7F0xFE0x7F0x800x010xC00x030xE00x070x700x0E0x380x1C0x1C0x380x0E

0x700x060x600x000x00// K
0x000x000xFE0x7F0xFE0x7F0x000x600x000x600x000x600x000x600x000x600x000x600x00

0x600x000x600x000x00// L
0x000x000xFE0x7F0xFE0x7F0x3C0x000xF00x000xC00x030xC00x030xF00x000x3C0x000xFE

0x7F0xFE0x7F0x000x00// M
0x000x000xFE0x7F0xFE0x7F0x1C0x000x700x000xE00x010x800x070x000x0E0x000x380xFE

0x7F0xFE0x7F0x000x00// N
0x000x000xE00x070xF80x1F0x1C0x380x0E0x700x060x600x060x600x0E0x700x1C0x380xF8

0x1F0xE00x070x000x00// O
0x000x000xFE0x7F0xFE0x7F0x060x030x060x030x060x030x060x030x060x030x8E0x030xFC

0x010xF80x000x000x00// P
0x000x000xE00x070xF80x1F0x1C0x380x0E0x700x060x600x060x6C0x0E0x7C0x1C0x380xF8

0x7F0xE00x670x000x00// Q
0x000x000xFE0x7F0xFE0x7F0x060x030x060x030x060x070x060x0F0x060x1F0x8E0x3B0xFC

0x710xF80x600x000x00// R
0x000x000x780x180xFC0x380xCE0x710x860x610x860x610x860x610x860x610x8E0x730x1C

0x3F0x180x1E0x000x00// S
0x000x000x000x000x060x000x060x000x060x000xFE0x7F0xFE0x7F0x060x000x060x000x06

0x000x000x000x000x00// T
0x000x000xFE0x0F0xFE0x3F0x000x700x000x600x000x600x000x600x000x600x000x700xFE

0x3F0xFE0x0F0x000x00// U
0x000x000x0E0x000x7E0x000xF00x030x800x1F0x000x7C0x000x7C0x800x1F0xF00x030x7E

0x000x0E0x000x000x00// V
0x000x000xFE0x7F0xFE0x7F0x000x380x000x0C0x000x070x000x070x000x0C0x000x380xFE

0x7F0xFE0x7F0x000x00// W
0x000x000x060x600x1E0x780x380x1C0x600x060xC00x030xC00x030x600x060x380x1C0x1E

0x780x060x600x000x00// X
0x000x000x060x000x1E0x000x780x000xE00x010x800x7F0x800x7F0xE00x010x780x000x1E

0x000x060x000x000x00// Y
0x000x000x060x600x060x780x060x7C0x060x660x860x630xC60x610x660x600x3E0x600x1E

0x600x060x600x000x00// Z
0x000x000x000x000x000x000xFE0x7F0xFE0x7F0x060x600x060x600x060x600x060x600x00

0x000x000x000x000x00// [
0x000x000x1C0x000x380x000x700x000xE00x000xC00x010x800x030x000x070x000x0E0x00

0x1C0x000x380x000x00// BackSlash
0x000x000x000x000x000x000x060x600x060x600x060x600x060x600xFE0x7F0xFE0x7F0x00

0x000x000x000x000x00//
0x000x000xC00x000xE00x000x700x000x380x000x1C0x000x0E0x000x1C0x000x380x000x70

0x000xE00x000xC00x00//
0x000x000x000x600x000x600x000x600x000x600x000x600x000x600x000x600x000x600x00

0x600x000x600x000x00// _
0x000x000x000x000x000x000x000x000x000x000x3E0x000x7E0x000x4E0x000x000x000x00

0x000x000x000x000x00// `
0x000x000x000x1C0x400x3E0x600x330x600x330x600x330x600x330x600x330x600x330xE0

0x3F0xC00x3F0x000x00// a
0x000x000xFE0x7F0xFE0x7F0x800x610xC00x600xC00x600xC00x600xC00x600xC00x710x80

0x3F0x000x1F0x000x00// b
0x000x000x800x0F0xC00x1F0xE00x380x600x300x600x300x600x300x600x300x600x300xC0

0x180x800x080x000x00// c
0x000x000x000x1F0x800x3F0xC00x710xC00x600xC00x600xC00x600xC00x610x800x610xFE

0x7F0xFE0x7F0x000x00// d
0x000x000x800x0F0xC00x1F0xE00x3B0x600x330x600x330x600x330x600x330x600x330xC0

0x130x800x010x000x00// e
0x000x000x000x000x800x010x800x010xF80x7F0xFC0x7F0x8E0x010x860x010x860x010x06

0x000x000x000x000x00// f
0x000x000xC00x010xE00x630x700x670x300x660x300x660x300x660x300x660x300x730xF0

0x3F0xF00x1F0x000x00// g
0x000x000xFE0x7F0xFE0x7F0x800x010xC00x000xC00x000xC00x000xC00x010x800x7F0x00

0x7F0x000x000x000x00// h
0x000x000x000x000x000x000x000x300x600x300xEC0x3F0xEC0x3F0x000x300x000x300x00

0x000x000x000x000x00// i
0x000x000x000x000x000x000x000x300x000x700x000x600x300x600xF60x7F0xF60x3F0x00

0x000x000x000x000x00// j
0x000x000x000x000xFE0x7F0xFE0x7F0x000x060x000x0F0x800x1F0xC00x390xC00x700x00

0x600x000x000x000x00// k
0x000x000x000x000x000x000x000x600x060x600xFE0x7F0xFE0x7F0x000x600x000x600x00

0x000x000x000x000x00// l
0x000x000xE00x3F0xC00x3F0xE00x000xE00x000xC00x3F0xC00x3F0xE00x000xE00x000xC0

0x3F0x800x3F0x000x00// m
0x000x000x000x000xE00x3F0xE00x3F0x600x000x600x000x600x000x600x000xE00x000xC0

0x3F0x800x3F0x000x00// n
0x000x000x800x0F0xC00x1F0xE00x380x600x300x600x300x600x300x600x300xE00x380xC0

0x1F0x800x0F0x000x00// o
0x000x000xF00x7F0xF00x7F0x300x060x300x0C0x300x0C0x300x0C0x300x0C0x700x0E0xE0

0x070xC00x030x000x00// p
0x000x000xC00x030xE00x070x700x0E0x300x0C0x300x0C0x300x0C0x300x0C0x300x060xF0

0x7F0xF00x7F0x000x00// q
0x000x000x000x000xE00x3F0xE00x3F0xC00x000x600x000x600x000x600x000x600x000xE0

0x000xC00x000x000x00// r
0x000x000x000x000xC00x110xE00x330x600x330x600x330x600x330x600x330x600x3F0x40

0x1E0x000x000x000x00// s
0x000x000x000x000x600x000x600x000xFE0x1F0xFE0x3F0x600x300x600x300x600x300x00

0x300x000x000x000x00// t
0x000x000xE00x0F0xE00x1F0x000x380x000x300x000x300x000x300x000x300x000x180xE0

0x3F0xE00x3F0x000x00// u
0x000x000x600x000xE00x010x800x070x000x1E0x000x380x000x380x000x1E0x800x070xE0

0x010x600x000x000x00// v
0x000x000xE00x070xE00x1F0x000x380x000x1C0xE00x0F0xE00x0F0x000x1C0x000x380xE0

0x1F0xE00x070x000x00// w
0x000x000x600x300xE00x380xC00x1D0x800x0F0x000x070x800x0F0xC00x1D0xE00x380x60

0x300x000x000x000x00// x
0x000x000x000x000x300x000xF00x400xC00x730x000x3F0x000x0F0xC00x030xF00x000x30

0x000x000x000x000x00// y
0x000x000x600x300x600x380x600x3C0x600x360x600x330xE00x310xE00x300x600x300x20

0x300x000x000x000x00// z
0x000x000x000x000x800x000xC00x010xFC0x1F0x7E0x3F0x070x700x030x600x030x600x03

0x600x000x000x000x00// {
0x000x000x000x000x000x000x000x000x000x000x7E0x7F0x7E0x7F0x000x000x000x000x00

0x000x000x000x000x00// |
0x000x000x000x000x030x600x030x600x030x600x070x700x7E0x3F0xFC0x1F0xC00x010x80

0x000x000x000x000x00// }
0x000x000x100x000x180x000x0C0x000x040x000x0C0x000x180x000x100x000x180x000x0C

0x000x040x000x000x00// ->
0x000x000x000x0F0x800x0F0xC00x0C0x600x0C0x300x0C0x300x0C0x600x0C0xC00x0C0x80

0x0F0x000x0F0x000x00  // <-
};

const 
uint8_t Font_6x8[] = {
0x000x000x000x000x000x00// (space)
0x000x000x5F0x000x000x00// !
0x000x070x000x070x000x00// "
0x140x7F0x140x7F0x140x00// #
0x240x2A0x7F0x2A0x120x00// $
0x230x130x080x640x620x00// %
0x360x490x550x220x500x00// &
0x000x050x030x000x000x00// '
0x000x1C0x220x410x000x00// (
0x000x410x220x1C0x000x00// )
0x080x2A0x1C0x2A0x080x00// *
0x080x080x3E0x080x080x00// +
0x000x500x300x000x000x00// ,
0x080x080x080x080x080x00// -
0x000x300x300x000x000x00// .
0x200x100x080x040x020x00// /
0x3E0x510x490x450x3E0x00// 0
0x000x420x7F0x400x000x00// 1
0x420x610x510x490x460x00// 2
0x210x410x450x4B0x310x00// 3
0x180x140x120x7F0x100x00// 4
0x270x450x450x450x390x00// 5
0x3C0x4A0x490x490x300x00// 6
0x010x710x090x050x030x00// 7
0x360x490x490x490x360x00// 8
0x060x490x490x290x1E0x00// 9
0x000x360x360x000x000x00// :
0x000x560x360x000x000x00// ;
0x000x080x140x220x410x00// <
0x140x140x140x140x140x00// =
0x410x220x140x080x000x00// >
0x020x010x510x090x060x00// ?
0x320x490x790x410x3E0x00// @
0x7E0x110x110x110x7E0x00// A
0x7F0x490x490x490x360x00// B
0x3E0x410x410x410x220x00// C
0x7F0x410x410x220x1C0x00// D
0x7F0x490x490x490x410x00// E
0x7F0x090x090x010x010x00// F
0x3E0x410x410x510x320x00// G
0x7F0x080x080x080x7F0x00// H
0x000x410x7F0x410x000x00// I
0x200x400x410x3F0x010x00// J
0x7F0x080x140x220x410x00// K
0x7F0x400x400x400x400x00// L
0x7F0x020x040x020x7F0x00// M
0x7F0x040x080x100x7F0x00// N
0x3E0x410x410x410x3E0x00// O
0x7F0x090x090x090x060x00// P
0x3E0x410x510x210x5E0x00// Q
0x7F0x090x190x290x460x00// R
0x460x490x490x490x310x00// S
0x010x010x7F0x010x010x00// T
0x3F0x400x400x400x3F0x00// U
0x1F0x200x400x200x1F0x00// V
0x7F0x200x180x200x7F0x00// W
0x630x140x080x140x630x00// X
0x030x040x780x040x030x00// Y
0x610x510x490x450x430x00// Z
0x000x000x7F0x410x410x00// [
0x020x040x080x100x200x00// "\"
0x410x410x7F0x000x000x00// ]
0x040x020x010x020x040x00// ^
0x400x400x400x400x400x00// _
0x000x010x020x040x000x00// `
0x200x540x540x540x780x00// a
0x7F0x480x440x440x380x00// b
0x380x440x440x440x200x00// c
0x380x440x440x480x7F0x00// d
0x380x540x540x540x180x00// e
0x080x7E0x090x010x020x00// f
0x080x140x540x540x3C0x00// g
0x7F0x080x040x040x780x00// h
0x000x440x7D0x400x000x00// i
0x200x400x440x3D0x000x00// j
0x000x7F0x100x280x440x00// k
0x000x410x7F0x400x000x00// l
0x7C0x040x180x040x780x00// m
0x7C0x080x040x040x780x00// n
0x380x440x440x440x380x00// o
0x7C0x140x140x140x080x00// p
0x080x140x140x180x7C0x00// q
0x7C0x080x040x040x080x00// r
0x480x540x540x540x200x00// s
0x040x3F0x440x400x200x00// t
0x3C0x400x400x200x7C0x00// u
0x1C0x200x400x200x1C0x00// v
0x3C0x400x300x400x3C0x00// w
0x440x280x100x280x440x00// x
0x0C0x500x500x500x3C0x00// y
0x440x640x540x4C0x440x00// z
0x000x080x360x410x000x00// {
0x000x000x7F0x000x000x00// |
0x000x410x360x080x000x00// }
0x080x080x2A0x1C0x080x00// ->
0x080x1C0x2A0x080x080x00// <-
};

const 
uint8_t Segment_25x40[] = {
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x0E0x000x000x000x000x1F0x000x000x000x000x1F0x000x00

0x000x000x1F0x000x000x000x000x1F0x000x000x000x000x1F0x000x000x000x000x1F0x00

0x000x000x000x1F0x000x000x000x000x0E0x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x00,  // Code for char .
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x00,  // Code for char /
0x000x000x000x000x000x000x000x000x000x000xF00xFF0xF70xFF0x070xE00xFF0xE30xFF

0x030xC40xFF0xC10xFF0x110x8C0xFF0x800xFF0x180x1C0x7F0x000x7F0x1C0x3C0x000x00

0x000x1E0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x00

0x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C

0x000x000x000x1F0x7C0x000x000x000x1F0x3C0x000x000x000x1E0x1C0x7F0x000x7F0x1C

0x8C0xFF0x800xFF0x180xC40xFF0xC10xFF0x110xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 0
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x7F0x000x7F0x00

0x800xFF0x800xFF0x000xC00xFF0xC10xFF0x010xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 1
0x000x000x000x000x000x000x000x000x000x000x000x000xF00xFF0x070x000x000xE00xFF

0x030x040x000xC00xFF0x110x0C0x000x880xFF0x180x1C0x000x1C0x7F0x1C0x3C0x000x3E

0x000x1E0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x00

0x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C

0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x3C0x000x3E0x000x1E0x1C0x7F0x1C0x000x1C

0x8C0xFF0x080x000x180xC40xFF0x010x000x100xE00xFF0x030x000x000xF00xFF0x070x00

0x000x000x000x000x000x000x000x000x000x000x00,  // Code for char 2
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x040x000x000x000x100x0C0x000x080x000x180x1C0x000x1C0x000x1C0x3C0x000x3E

0x000x1E0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x00

0x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C

0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x3C0x000x3E0x000x1E0x1C0x7F0x1C0x7F0x1C

0x8C0xFF0x880xFF0x180xC40xFF0xC10xFF0x110xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 3
0x000x000x000x000x000x000x000x000x000x000xF00xFF0x070x000x000xE00xFF0x030x00

0x000xC00xFF0x010x000x000x800xFF0x080x000x000x000x7F0x1C0x000x000x000x000x3E

0x000x000x000x000x3E0x000x000x000x000x3E0x000x000x000x000x3E0x000x000x000x00

0x3E0x000x000x000x000x3E0x000x000x000x000x3E0x000x000x000x000x3E0x000x000x00

0x000x3E0x000x000x000x000x3E0x000x000x000x000x3E0x000x000x000x7F0x1C0x7F0x00

0x800xFF0x880xFF0x000xC00xFF0xC10xFF0x010xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 4
0x000x000x000x000x000x000x000x000x000x000xF00xFF0x070x000x000xE00xFF0x030x00

0x000xC40xFF0x010x000x100x8C0xFF0x080x000x180x1C0x7F0x1C0x000x1C0x3C0x000x3E

0x000x1E0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x00

0x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C

0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x3C0x000x3E0x000x1E0x1C0x000x1C0x7F0x1C

0x0C0x000x880xFF0x180x040x000xC00xFF0x110x000x000xE00xFF0x030x000x000xF00xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 5
0x000x000x000x000x000x000x000x000x000x000xF00xFF0xF70xFF0x070xE00xFF0xE30xFF

0x030xC00xFF0xC10xFF0x110x800xFF0x880xFF0x180x000x7F0x1C0x7F0x1C0x000x000x3E

0x000x1E0x000x000x3E0x000x1F0x000x000x3E0x000x1F0x000x000x3E0x000x1F0x000x00

0x3E0x000x1F0x000x000x3E0x000x1F0x000x000x3E0x000x1F0x000x000x3E0x000x1F0x00

0x000x3E0x000x1F0x000x000x3E0x000x1F0x000x000x3E0x000x1E0x000x000x1C0x7F0x1C

0x000x000x880xFF0x180x000x000xC00xFF0x110x000x000xE00xFF0x030x000x000xF00xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 6
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x040x000x000x000x000x0C0x000x000x000x000x1C0x000x000x000x000x3C0x000x00

0x000x000x7C0x000x000x000x000x7C0x000x000x000x000x7C0x000x000x000x000x7C0x00

0x000x000x000x7C0x000x000x000x000x7C0x000x000x000x000x7C0x000x000x000x000x7C

0x000x000x000x000x7C0x000x000x000x000x3C0x000x000x000x000x1C0x7F0x000x7F0x00

0x8C0xFF0x800xFF0x000xC40xFF0xC10xFF0x010xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 7
0x000x000x000x000x000x000x000x000x000x000xF00xFF0xF70xFF0x070xE00xFF0xE30xFF

0x030xC40xFF0xC10xFF0x110x8C0xFF0x880xFF0x180x1C0x7F0x1C0x7F0x1C0x3C0x000x3E

0x000x1E0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x00

0x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x7C

0x000x3E0x000x1F0x7C0x000x3E0x000x1F0x3C0x000x3E0x000x1E0x1C0x7F0x1C0x7F0x1C

0x8C0xFF0x880xFF0x180xC40xFF0xC10xFF0x110xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 8
0x000x000x000x000x000x000x000x000x000x000xF00xFF0x070x000x000xE00xFF0x030x00

0x000xC40xFF0x010x000x000x8C0xFF0x080x000x000x1C0x7F0x1C0x000x000x3C0x000x3E

0x000x000x7C0x000x3E0x000x000x7C0x000x3E0x000x000x7C0x000x3E0x000x000x7C0x00

0x3E0x000x000x7C0x000x3E0x000x000x7C0x000x3E0x000x000x7C0x000x3E0x000x000x7C

0x000x3E0x000x000x7C0x000x3E0x000x000x3C0x000x3E0x000x000x1C0x7F0x1C0x7F0x00

0x8C0xFF0x880xFF0x000xC40xFF0xC10xFF0x010xE00xFF0xE30xFF0x030xF00xFF0xF70xFF

0x070x000x000x000x000x000x000x000x000x000x00,  // Code for char 9
0x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x000x00

0x000x040x000x000x000x100x0C0x000x000x000x180x1C0x000x000x000x1C0x3C0x000x00

0x000x1E0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x00

0x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C0x000x000x000x1F0x7C

0x000x000x000x1F0x7C0x000x000x000x1F0x3C0x000x000x000x1E0x1C0x000x000x000x1C

0x0C0x000x000x000x180x040x000x000x000x100x000x000x000x000x000x000x000x000x00

0x000x000x000x000x000x000x000x000x000x000x00   // Code for char :
};
#endif



Şimdiik bu kadar.
Kamera dandik olduğundan videoda bir şey gözükmez ama güzel kamera bulursam çekerim :D

mesaj birleştirme:: 03 Mayıs 2015, 22:27:51

Unutmadan SSD'nin datasheet'i : https://www.adafruit.com/datasheets/SSD1306.pdf

Bütün detaylar mevcut.Mesela sayfa 37 de

10.1.12 Set Display ON/OFF (AEh/AFh)
AEh : Display OFF
AFh : Display ON   demiş.

Oled_Command(0xAE); ile Displayi uyku moduna alabilirsiniz.

baran123

05 Mayıs 2015, 03:23:01 #31 Son düzenlenme: 05 Mayıs 2015, 03:24:29 Baran Ekrem
Merhaba arkadaşlar bugün Usart notlarını paylaşacağım :) Örnek ve test amaçlı USB/Serial Çevirici vasıtasıyla

bilgisayar ile haberleştirdim.

Oldukça basit bir kullanımı var.Ben USART 1'i kullandım.Kod üzerinden açıkalyayım.Tabi öncelikle USART 1 pinlerini

STM32F0 da hangi pinlerde kullanabiliriz buna bir bakalım.Datasheet sayfa 34 de USART 1 'i PA9(TX), PA10(RX) olarak

kullanılabiliyormuş, ben böyle ayarladım.


#include "stm32f0xx_conf.h"
#include "main.h"

static void Init_USART(void);//Usart hazırama fonksiyon prototipi

int main(void)
{
    
Init_USART();//usart hazırla

    
while(1)
    {
        while(
USART_GetFlagStatus(USART1USART_FLAG_TXE) == RESET);//gönderme bayrağı 0 da ise 
        
USART_SendData(USART1'X'); // sürekli 'x' karakterini gönder
    
}
}

static 
void Init_USART(void)
{
    
USART_InitTypeDef USART_InitTypeDefStructure;//usart structure
    
GPIO_InitTypeDef  GPIO_InitTypeDefStructure;
    
NVIC_InitTypeDef  NVIC_InitStructure;

    
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOAENABLE);//a portu için clock
    
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1ENABLE); //usart 1 clock

    
GPIO_PinAFConfig(GPIOAGPIO_PinSource9GPIO_AF_1);
/* alternative func... AF_0 içinde usart 1 kullanılır demiş açıklamada ama ben denedim çalışmadı.
1 için de diyordu bu modda çalıştı ne hikmetse.*/
    
GPIO_PinAFConfig(GPIOAGPIO_PinSource10,GPIO_AF_1);

    
GPIO_InitTypeDefStructure.GPIO_Mode  GPIO_Mode_AF;
    
GPIO_InitTypeDefStructure.GPIO_OType GPIO_OType_PP;
    
GPIO_InitTypeDefStructure.GPIO_Pin   GPIO_Pin_9 GPIO_Pin_10//USART 1 : PA9 = TX, PA10 = RX
    
GPIO_InitTypeDefStructure.GPIO_PuPd  GPIO_PuPd_UP;//high seviyede tutulyor pull up
    
GPIO_InitTypeDefStructure.GPIO_Speed GPIO_Speed_50MHz
    
GPIO_Init(GPIOA,&GPIO_InitTypeDefStructure);

    
NVIC_InitStructure.NVIC_IRQChannel USART1_IRQn;
    
NVIC_InitStructure.NVIC_IRQChannelPriority 0;//rx kesmesi için nvic ayarları 
    
NVIC_InitStructure.NVIC_IRQChannelCmd ENABLE;
    
NVIC_Init(&NVIC_InitStructure);

    
USART_InitTypeDefStructure.USART_BaudRate            9600;//baud rate 
    
USART_InitTypeDefStructure.USART_HardwareFlowControl USART_HardwareFlowControl_None;
    
USART_InitTypeDefStructure.USART_Mode                USART_Mode_Rx USART_Mode_Tx;//alıcı ve verici modda 
    
USART_InitTypeDefStructure.USART_Parity              USART_Parity_No;//parity biti yok
    
USART_InitTypeDefStructure.USART_StopBits            USART_StopBits_1;//stop biti 1 
    
USART_InitTypeDefStructure.USART_WordLength          USART_WordLength_8b;//8 bitlik datalar gönderilecek
    
USART_Init(USART1,&USART_InitTypeDefStructure);

    
USART_Cmd(USART1,ENABLE);//usart 1 aktif

    
USART_ITConfig(USART1USART_IT_RXNEENABLE);//USART 1 rx kesmesi aktif (veri geldiğin de düşülecek fonksiyon, 

stm32f00xx_it.c ve .h dosyalarını ekliyoruz projeye)

}



stm32f00xx_it.c

void USART1_IRQHandler
(void)
{
    if (
USART_GetITStatus(USART1USART_IT_RXNE) != RESET)// usart 1 rx bayrağı reset(0) değil se , veri geldi
    
{
	
if((
char)USART_ReceiveData(USART1) == 'A')//veri alma fonskiyonu uint16 döndürüyor siz karakter kontrolü 

yapacaksanız char a çevirip sağlama alabilirsiniz
        
{
            
//gelen veri A karakteri ise işlem yap
        
}
    }
}


Bu kadar :)

mesaj birleştirme:: 05 Mayıs 2015, 03:24:29

Dip not : stm32f00xx_it.h dosyasında isterseniz void USART1_IRQHandler(void); şeklinde prototipini tanımlayabilirsiniz.

eeburakdemir

@ Baran Ekrem hocam ben bu örneği stm32f4 disc. denemeye çalışıyorum da , 164 ün bacaklarından segmentlere sürme sırası nedir yada  bağlantılarını yazarmısınız ? pic de yaptığımız gibi 13 den itibaren a ile başlayıp sıralıyormusunuz ?
Asla pes etme...

baran123

Merhaba @eeburakdemir
Q0 - A
Q1 - B
Şeklinde bağlantı yapılıyor.

eeburakdemir

@Baran Ekrem teşekkürler , deneyeceğim ve en kısa süre içinde yazacağım. Çalıştığım için geç yazdım kusura bakma
Asla pes etme...

baran123

Estağfurullah. :) Zaten biraz ara verdik.En kısa zamanda yeni uygulamalar ve dersler ekleyeceğiz.İlgin için teşekkür ederim.

eeburakdemir

Asla pes etme...

baran123


Sya

Hocam std library yerine stmcubemx in hal library kullansak daha kolay olmaz mı ?

baran123

Alıntı yapılan: Sya - 12 Eylül 2015, 00:46:28
Hocam std library yerine stmcubemx in hal library kullansak daha kolay olmaz mı ?
Bunu bir öğrenelim de onuda yaparız ;)


M_B

Merhabalar,
Burdaki tüm örnekleri keil ile yeniden düzenleyip derliyorum.
SPI örneğini derlerken şu şekilde hata alıyorum
Alıntıssd1306.c(106): error:  #18: expected a ")"
     low_column = (seg & 0b00001111);
ssd1306.c(107): error:  #18: expected a ")"
     hig_column = (seg & 0b11110000)>>4;
ssd1306.c(108): error:  #65: expected a ";"
     hig_column = hig_column | 0b00010000;
ssd1306.c(109): error:  #18: expected a ")"
     pag = (pag & 0b00000111);
ssd1306.c(110): error:  #18: expected a ")"
     pag = (pag | 0b10110000);

Yukardaki hatada belirtilen fonksiyon ise

void Oled_SetPointer
(uint8_t seguint8_t pag)
{
   
uint8_t low_columnhig_column;

   
low_column = (seg 0b00001111);         // 106 nolu satır.
   
hig_column = (seg 0b11110000)>>4;    // 107 nolu satır.
   
hig_column hig_column 0b00010000;
   
pag = (pag 0b00000111);
   
pag = (pag 0b10110000);                  // 110 nolu satır.
   
Oled_Command(low_column);
   
Oled_Command(hig_column);
   
Oled_Command(pag);
}


Bu hatayı nasıl cözebilirim.
İmkanın sınırlarını görmek için imkansızı denemek lazım.                                                             Fatih Sultan Mehmet

M_B

Merhabalar;
Fonksiyonu aşağıdaki gibi düzenleyince hata mesajı gitti.


void Oled_SetPointer
(uint8_t seguint8_t pag)
{
   
uint8_t low_columnhig_column;

   
low_column = (seg 0x0F);
   
hig_column = (seg 0xF0)>>4;
   
hig_column hig_column 0x10;
   
pag = (pag 0x07);
   
pag = (pag 0xB0);
   
Oled_Command(low_column);
   
Oled_Command(hig_column);
   
Oled_Command(pag);
}


Peki değişen ne oldu ki
Birisinde Binary yazım diğerinde ise Hex 

İmkanın sınırlarını görmek için imkansızı denemek lazım.                                                             Fatih Sultan Mehmet

M_B

İmkanın sınırlarını görmek için imkansızı denemek lazım.                                                             Fatih Sultan Mehmet

baran123

Evet aynı derten bende muzdarip oldum hocam :)
Hex şeklinde yazınca düzeldi.

Yasal Uyarı: Picproje.org sitemizde 5651 sayılı kanunun 8. maddesine ve T.C.Knın 125. maddesine göre tüm üyelerimiz yaptıkları paylaşımlardan kendileri sorumludur. Picproje.org hakkında yapılacak tüm hukuksal şikayetleri İletişim sayfamızdan bize bildirdikten en geç 3 (üç) iş günü içerisinde ilgili kanunlar ve yönetmelikler çerçevesinde tarafımızca incelenerek gereken işlemler yapılacak ve site yöneticilerimiz tarafından bilgi verilecektir.