STM32F107 ile GLCD kullanımı Kütüphane sorunu

Başlatan Mucit23, 23 Ekim 2012, 12:04:52

Mucit23

Teşekkür ederim yeni öğrendim bu işlemi. Şimdi Hallettim.

Kazım

#16
integer dan String dönüşümü için =>   char * itoa ( int value, char * str, int base ) fonksiyonunu da kullanabilirsiniz.Bu sayede base paramtersini 2 girerseniz değişkeniniz< Bİnary formatlı-10 girerseniz decimalformatlı çıktılarını alabilrisiniz.Kullanım örneği:

unsigned char tempVal=255;
unsigned char bufferStr[]=" ";
unsigned char base=2;

fonksiyonun çağırılması:

itoa(tempVal,bufferStr,base);

lcdDisplay(bufferStr);    => çıktısı Binary tabanda 11111111 olacaktır.    Yada 255 için base 10 olmalı.


Mucit23

Evet dediğiniz şekildede denedim oluyor. Problem yok.

Konuyla alakasız ama bir soru daha sormak isterim.
Usart kesmesini nasıl kullanılabilir hale getiririm. Bu konuda bir örnek gösterebilirmisiniz.

X-Fi

önce usart'ı çalışır duruma getir sonra aşağıdaki gibi kesmeyi kur.

/*USARTx Kesme Aktif */
  USART_ITConfig(USARTx, USART_IT_TXE, ENABLE);
  USART_ITConfig(USARTx, USART_IT_RXNE, ENABLE);

  NVIC_InitStructure.NVIC_IRQChannel = USARTx_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);


veri geldiğinde veya gönderme bittiğinde kesme vektörüne gidecek

void USARTx_IRQHandler(void)
{

  /* seri gönderildi kesmesi -------------------------------------------------*/
  if (USART_GetITStatus(USARTx, USART_IT_TXE) == SET)
  {

  }

/* seri alındı kesmesi --------------------------------------------------*/
  if (USART_GetITStatus(USARTx, USART_IT_RXNE) == SET)
  {
 
  }

}


tx ve rx için buffer lar tanımlamalısın gelen flaglara göre bufferları doldurup boşaltırsın. kesmeleri işi bittikten sonra disable yaparak temizlemiş olursun bide timeout saydırman gerekicek onuda sticktimer ile sayabilirsin. Kolay gelsin.
http://www.coskunergan.dev/    (Yürümekle varılmaz, lakin varanlar yürüyenlerdir.)

Mucit23

Sizin Expkits için hazırladığını örneklere bakıyorum Orada hazırlamış olduğunuz RS232 uygulamasında daha açık bir şekilde anlatmışsınız. Bakayım Umarım Yapabilirim.

muhittin_kaplan

Şurada Bir Driver buldum. Donanımım Hazır Olmadığından deneme fırsatım olmadı

http://en.radzio.dxp.pl/ks0108/

Mucit23

Merhaba Arkadaşlar

Usartta ne yaptıysa usart kesmesini bir türlü yönlendiremedim. Nerede hata yapıyorum görmek istiyorum..
X-Fi nin yaptığı çalışmalara bakım benim çalıştığım kodlara uyarlama yapmaya çalışıyorum

com.h diye bir kütüphane dosyası oluşturup programa ekledim. Bu dosya içerisinde usart ayarlarını yapıyorum. Ayrıca veri gönderme ve alma işlemlerini yapıyorumdum.

Veri göndermede bir problem yok.
Alırken ise döngü içerisinde sürekli data geldimi diye kontrol edersem bir şekilde datanın geldiğini görüyorum. Amacım gelen stringleri diziye yerleştirmek

stm3210x_it.c dosyasında USART1_IRQHandler fonksiyonunda gerekli data alım işlemini yapıyorum. Sanki hiç kesme buraya düşmüyor.

Yazdığım kodlar bu şekilde

Bi kodları inceleyin lütfen

main.c ;

#include "stm32f107.h"
#include "stdio.h"
#define arraySize(array) (sizeof(array)/sizeof(*array))

void sendUSART1(char *array);
int tx_c=0;

int RecievedData;
char ekran[];

int main()
{
/***********BASLANGIC AYARLARI************/	
	SystemInit(2);	
	initADC1();
	initRS232(9600);
	//setTimer1(100,1,1);	  Timer interrupt aktif edildi.
/***************KS0108 INIT********************/	
	 setOutMode(portD,0x00FF);//glcd data pinleri PortD nin agirlikli ilk 8 bitine bagli
	 setOutMode(portE,0xFFFF);
	 setOutMode(portA,0x0001);
     ks0108_init();	
/**********************************************/	
  	
	while(1)
	{	
		//ks0108_text(3,4,"BESEMOT",1,1);
		ks0108_text(8,16,"USART1",2,1);
		ks0108_text(5,36,"Mucit23",3,1);
		ks0108_line(0,0,127,0,1);
		ks0108_line(127,0,127,63,1);
		ks0108_line(0,0,0,63,1);
		ks0108_line(0,63,127,63,1);
		ks0108_rect(85,3,125,30,0,1);
		ks0108_rect(87,5,123,28,0,1);
		ks0108_rect(89,7,121,26,0,1);
		ks0108_rect(91,9,119,24,0,1);
		ks0108_rect(93,11,117,22,0,1);	

		for(;;)
		{
		sendUSART1("Merhaba Dunya ");
		ks0108_text(3,4,RxBuffer1,1,1);
		delayMs(3);
    }
}
}

void sendUSART1(char *array){
	int size=strlen(array);
	for(tx_c=0;tx_c<=size;tx_c++){
		rs232SendData(array,size);
		//delayMs(1);
	}
}


void Timer1_Interrupt()
{
   
}


Hazırladığım com.h dosyası
#include "stm32f10x_lib.h"
#include "main.h"

/*********************************************************//***/
void initRS232(int baud);
void rs232SendData(char *data,int data_length);//data dizisini belirtilen uzunlukta dinleyici tarafa gonderir
//char rs232ReadData(void);//göndereci taraftan gonderilen datalari char cahar okur.
/*********************************************************//***/

vu8 TxCounter1 = 0x00;
char RxBuffer1[16];
vu8 RxCounter1=0;

/********************************setRS232*****************************************/
/*
	* USAR1 modulunu belirtilen baud hizinda setler
	* TX  portA nin 9. pini, RX portA nin 10. pini olarak ayarlanmistir
	*	istenirse bu degerler degistirilebilir.
*/
void initRS232(int baud){
	
				USART_InitTypeDef USART_InitStructure;

				RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA
														 | RCC_APB2Periph_AFIO, ENABLE);

				/* Configure USART1 Rx (PA.10) as input floating */
				GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
				GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
				GPIO_Init(GPIOA, &GPIO_InitStructure);

  		/* Configure USART1 Tx (PA.09) as alternate function push-pull */
  	  	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  	  	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  	  	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  	  	GPIO_Init(GPIOA, &GPIO_InitStructure);

  	  /* USART1  ayarlari ------------------------------------------------------*/
  	      /*  - BaudRate =  baud
  	          - Word Length = 8 Bits
  	          - One Stop Bit
  	          - No parity
  	          - Hardware flow control disabled (RTS ve CTS )
  	          - Receive ve transmit aktif
  	    	*/
  	    	USART_InitStructure.USART_BaudRate = baud;
  	    	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;

  	    	/* USART1 ayarlari yüklenir */
  	    	USART_Init(USART1, &USART_InitStructure);

  	    	/* USART1 alim-gönderim kesmeleri aktif */
  	    	 USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
  	    	 USART_ITConfig(USART1, USART_IT_TXE, ENABLE);

  	    	/*  USART1 Aktif*/
  	    	USART_Cmd(USART1, ENABLE);
}
/*************************************************************************************/
/********************************rs232SendData****************************************/
/*
	* data dizinin elamanlarini belirtilen boyutuna(data_length) kadar USAR1 kanalina gonderir.
	*  
*/
void rs232SendData(char *data,int data_length){
			USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
	//USART1 kanali reset durumunda degilse
	if(USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
  {
		
		/*Transmit data register ina dizinin elemanlarini sirayla ekle*/
    USART_SendData(USART1, (data[TxCounter1++]));

    if(TxCounter1 == data_length)
    {
			TxCounter1=0;
      /* USAST1 Transmit kanalini pasif et */
      USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
    }
  }

}
///************************************************************************************/
//char rs232ReadData(){
//return USART_ReceiveData(USART1);
//}


En altta rs232ReadData diye bir fonksiyon var. Bu fonksiyonda Gelen stringiokuyabiliyorum. Şimdilik bu fonksiyonu kapatmışı.

İşlemciye ait genel ayarlarıda burada yapıyorum.
////////////////////////////////////////////////////////////////////////////////
//  Author   : [FERHAT YOL]											
//  Notice   : Copyright (c) 2012
//           : All Rights Reserved
//  Date     : 
//  Version  : 1.0.0
//  MCU 	 : STM32F107VC
//  Notes    : DEFAULT AYARLAMALAR
////////////////////////////////////////////////////////////////////////////////

#include "stm32f10x_lib.h"
#include "port.h"
#include "main.h"
#include "ks0108.h"
#include "com.h"
#include "adc.h"
#include "stdio.h"


//#define arraySize(array) (sizeof(array)/sizeof(*array))
void SystemInit(int clockMull);
void RCC_Configuration(int clockMull);
void NVIC_Configuration(void);
void setTimer1(u32 period,u32 prescaler,u32 clockdivision);
void delayMs(vu32 ms);
static vu32 TimingDelay;
/********************************SYSTEMINIT************************************/
void SystemInit(int clockMull){//clockMull clock carpani 1 veya 2 olabilir=> 2 olursa 64 mhz, 1 olursa 32 mhz de calisir
		/* System Clocks Configuration */
  	RCC_Configuration(clockMull); 
  	/* NVIC Configuration */
  	NVIC_Configuration();
  	/* SysTick clock 1ms için 4MHz (HCLK/8, default) */
  	SysTick_SetReload(4000);
  	/* SysTick Kesmesi Aktif */
	
  	SysTick_ITConfig(ENABLE);
		
}

/*******************************************************************************/
void setTimer1(u32 period,u32 prescaler,u32 clockdivision){
		
	
		TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
		/* TIM1 clock enable */
  	RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE); 
		/* TIM1 ayarlari */
  	TIM_TimeBaseStructure.TIM_Period = period;
  	TIM_TimeBaseStructure.TIM_Prescaler = prescaler;
  	TIM_TimeBaseStructure.TIM_ClockDivision = clockdivision;
  	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
  	TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
 
  	/* TIM1 güncelleme kesmesi aktif */
	   TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
	
			/* TIM1 sayici aktif */
			TIM_Cmd(TIM1, ENABLE);
			//GPIO_Write(GPIOB,0x00FF);
	
}


/*******************************************************************************/
void RCC_Configuration(int clokMull)
{
    /* RCC system reset(for debug purpose) */
    RCC_DeInit();
    /* HSE kapali */
    RCC_HSEConfig(RCC_HSE_OFF);
    /* Prefetch Buffer aktif */
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
    /* Flash ulasimi 2 clock */
    FLASH_SetLatency(FLASH_Latency_2);
    /* HCLK = SYSCLK */
    RCC_HCLKConfig(RCC_SYSCLK_Div1);
    /* PCLK2 = HCLK */
    RCC_PCLK2Config(RCC_HCLK_Div1);
    /* PCLK1 = HCLK/2 */
    RCC_PCLK1Config(RCC_HCLK_Div2);
    /* PLLCLK = (8MHz(internal osc)/2) * 8 = 32 MHz */
    RCC_PLLConfig(RCC_PLLSource_HSI_Div2, clokMull*RCC_PLLMul_8);
    /* PLL Aktif */
    RCC_PLLCmd(ENABLE);
    /* PLL hazir olmasini bekle */
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
    /* System clock kaynagi PLL cikisi secildi */
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
    /* System clock kaynagi hazir olmasini bekle */
    while(RCC_GetSYSCLKSource() != 0x08);
}
/*******************************************************************************/

/*******************************************************************************/
void NVIC_Configuration(void)
{
	  NVIC_InitTypeDef NVIC_InitStructure;

			#ifdef  VECT_TAB_RAM
				/*  Vectör kaynagi adresi:  0x20000000 */
				NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
			#else  /* VECT_TAB_FLASH  */
				/*  Vektör kaynagi adresi:  0x08000000 */
				NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
			#endif
			 /* TIM1 güncellenme kesmesi tanitildi */
				NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQChannel;
				NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
				NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
				NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

			  NVIC_Init(&NVIC_InitStructure);
 
}


/***********************************delayMs**************************************/
void delayMs(u32 ms)
{
  /* SysTick Counter aktif */
  SysTick_CounterCmd(SysTick_Counter_Enable);
  
  TimingDelay = ms;

  while(TimingDelay != 0);

  /* SysTick Counter Pasif */
  SysTick_CounterCmd(SysTick_Counter_Disable);
  /* SysTick Counter temizlenir */
  SysTick_CounterCmd(SysTick_Counter_Clear);
}
/*******************************************************************************/

/*******************************************************************************/
void TimingDelay_Decrement(void)
{
  if (TimingDelay != 0x00)
  { 
    TimingDelay--;
  }
}
/*******************************************************************************/


Son olarak kesmelerin yönlendirildiği dosya
/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
* File Name          : stm32f10x_it.c
* Author             : MCD Application Team
* Version            : V2.0.1
* Date               : 06/13/2008
* Description        : Main Interrupt Service Routines.
*                      This file provides template for all exceptions handler
*                      and peripherals interrupt service routine.
********************************************************************************
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"
#include "main.h"

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

extern u8 RxBuffer1[];
extern vu8 RxCounter1; 
extern u8 NbrOfDataToRead1;

/*******************************************************************************
* Function Name  : NMIException
* Description    : This function handles NMI exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void NMIException(void)
{
}

/*******************************************************************************
* Function Name  : HardFaultException
* Description    : This function handles Hard Fault exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void HardFaultException(void)
{
  /* Go to infinite loop when Hard Fault exception occurs */
  while (1)
  {
  }
}

/*******************************************************************************
* Function Name  : MemManageException
* Description    : This function handles Memory Manage exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void MemManageException(void)
{
  /* Go to infinite loop when Memory Manage exception occurs */
  while (1)
  {
  }
}

/*******************************************************************************
* Function Name  : BusFaultException
* Description    : This function handles Bus Fault exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void BusFaultException(void)
{
  /* Go to infinite loop when Bus Fault exception occurs */
  while (1)
  {
  }
}

/*******************************************************************************
* Function Name  : UsageFaultException
* Description    : This function handles Usage Fault exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UsageFaultException(void)
{
  /* Go to infinite loop when Usage Fault exception occurs */
  while (1)
  {
  }
}

/*******************************************************************************
* Function Name  : DebugMonitor
* Description    : This function handles Debug Monitor exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DebugMonitor(void)
{
}

/*******************************************************************************
* Function Name  : SVCHandler
* Description    : This function handles SVCall exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SVCHandler(void)
{
}

/*******************************************************************************
* Function Name  : PendSVC
* Description    : This function handles PendSVC exception.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void PendSVC(void)
{
}

/*******************************************************************************
* Function Name  : SysTickHandler
* Description    : This function handles SysTick Handler.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SysTickHandler(void)
{
  TimingDelay_Decrement();
}

/*******************************************************************************
* Function Name  : WWDG_IRQHandler
* Description    : This function handles WWDG interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void WWDG_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : PVD_IRQHandler
* Description    : This function handles PVD interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void PVD_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TAMPER_IRQHandler
* Description    : This function handles Tamper interrupt request. 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TAMPER_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : RTC_IRQHandler
* Description    : This function handles RTC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTC_IRQHandler(void)
{

}

/*******************************************************************************
* Function Name  : FLASH_IRQHandler
* Description    : This function handles Flash interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void FLASH_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : RCC_IRQHandler
* Description    : This function handles RCC interrupt request. 
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RCC_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI0_IRQHandler
* Description    : This function handles External interrupt Line 0 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI0_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI1_IRQHandler
* Description    : This function handles External interrupt Line 1 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI1_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI2_IRQHandler
* Description    : This function handles External interrupt Line 2 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI3_IRQHandler
* Description    : This function handles External interrupt Line 3 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI4_IRQHandler
* Description    : This function handles External interrupt Line 4 request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI4_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel1_IRQHandler
* Description    : This function handles DMA1 Channel 1 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel1_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel2_IRQHandler
* Description    : This function handles DMA1 Channel 2 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel3_IRQHandler
* Description    : This function handles DMA1 Channel 3 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel4_IRQHandler
* Description    : This function handles DMA1 Channel 4 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel4_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel5_IRQHandler
* Description    : This function handles DMA1 Channel 5 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel5_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel6_IRQHandler
* Description    : This function handles DMA1 Channel 6 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel6_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA1_Channel7_IRQHandler
* Description    : This function handles DMA1 Channel 7 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA1_Channel7_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : ADC1_2_IRQHandler
* Description    : This function handles ADC1 and ADC2 global interrupts requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ADC1_2_IRQHandler(void)
{
	
}

/*******************************************************************************
* Function Name  : USB_HP_CAN_TX_IRQHandler
* Description    : This function handles USB High Priority or CAN TX interrupts 
*                  requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USB_HP_CAN_TX_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : USB_LP_CAN_RX0_IRQHandler
* Description    : This function handles USB Low Priority or CAN RX0 interrupts 
*                  requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USB_LP_CAN_RX0_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : CAN_RX1_IRQHandler
* Description    : This function handles CAN RX1 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void CAN_RX1_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : CAN_SCE_IRQHandler
* Description    : This function handles CAN SCE interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void CAN_SCE_IRQHandler(void)
{
	
}

/*******************************************************************************
* Function Name  : EXTI9_5_IRQHandler
* Description    : This function handles External lines 9 to 5 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI9_5_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM1_BRK_IRQHandler
* Description    : This function handles TIM1 Break interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM1_BRK_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM1_UP_IRQHandler
* Description    : This function handles TIM1 overflow and update interrupt 
*                  request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM1_UP_IRQHandler(void)
{
   TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
   Timer1_Interrupt();
}

/*******************************************************************************
* Function Name  : TIM1_TRG_COM_IRQHandler
* Description    : This function handles TIM1 Trigger and commutation interrupts 
*                  requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM1_TRG_COM_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM1_CC_IRQHandler
* Description    : This function handles TIM1 capture compare interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM1_CC_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM2_IRQHandler
* Description    : This function handles TIM2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM3_IRQHandler
* Description    : This function handles TIM3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM4_IRQHandler
* Description    : This function handles TIM4 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM4_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : I2C1_EV_IRQHandler
* Description    : This function handles I2C1 Event interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C1_EV_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : I2C1_ER_IRQHandler
* Description    : This function handles I2C1 Error interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C1_ER_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : I2C2_EV_IRQHandler
* Description    : This function handles I2C2 Event interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C2_EV_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : I2C2_ER_IRQHandler
* Description    : This function handles I2C2 Error interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void I2C2_ER_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : SPI1_IRQHandler
* Description    : This function handles SPI1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI1_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : SPI2_IRQHandler
* Description    : This function handles SPI2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : USART1_IRQHandler
* Description    : This function handles USART1 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART1_IRQHandler(void)
{
  if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
  {
    /* Read one byte from the receive data register */
    RxBuffer1[RxCounter1++] = USART_ReceiveData(USART1);      

    if(RxCounter1 == NbrOfDataToRead1)
    {
      /* Disable the USART1 Receive interrupt */
     // USART_ITConfig(USART1, USART_IT_RXNE, DISABLE);
    }
  }
}

/*******************************************************************************
* Function Name  : USART2_IRQHandler
* Description    : This function handles USART2 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : USART3_IRQHandler
* Description    : This function handles USART3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USART3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : EXTI15_10_IRQHandler
* Description    : This function handles External lines 15 to 10 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void EXTI15_10_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : RTCAlarm_IRQHandler
* Description    : This function handles RTC Alarm interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RTCAlarm_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : USBWakeUp_IRQHandler
* Description    : This function handles USB WakeUp interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void USBWakeUp_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM8_BRK_IRQHandler
* Description    : This function handles TIM8 Break interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM8_BRK_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM8_UP_IRQHandler
* Description    : This function handles TIM8 overflow and update interrupt 
*                  request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM8_UP_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM8_TRG_COM_IRQHandler
* Description    : This function handles TIM8 Trigger and commutation interrupts 
*                  requests.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM8_TRG_COM_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM8_CC_IRQHandler
* Description    : This function handles TIM8 capture compare interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM8_CC_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : ADC3_IRQHandler
* Description    : This function handles ADC3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void ADC3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : FSMC_IRQHandler
* Description    : This function handles FSMC global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void FSMC_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : SDIO_IRQHandler
* Description    : This function handles SDIO global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SDIO_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM5_IRQHandler
* Description    : This function handles TIM5 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM5_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : SPI3_IRQHandler
* Description    : This function handles SPI3 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void SPI3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : UART4_IRQHandler
* Description    : This function handles UART4 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UART4_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : UART5_IRQHandler
* Description    : This function handles UART5 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void UART5_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM6_IRQHandler
* Description    : This function handles TIM6 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM6_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : TIM7_IRQHandler
* Description    : This function handles TIM7 global interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void TIM7_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA2_Channel1_IRQHandler
* Description    : This function handles DMA2 Channel 1 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA2_Channel1_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA2_Channel2_IRQHandler
* Description    : This function handles DMA2 Channel 2 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA2_Channel2_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA2_Channel3_IRQHandler
* Description    : This function handles DMA2 Channel 3 interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA2_Channel3_IRQHandler(void)
{
}

/*******************************************************************************
* Function Name  : DMA2_Channel4_5_IRQHandler
* Description    : This function handles DMA2 Channel 4 and DMA2 Channel 5
*                  interrupt request.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void DMA2_Channel4_5_IRQHandler(void)
{
}

/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/


Yardımcı olursanız sevinirim gerçekten..

X-Fi

Usart Rx bayrağını aktif ediyorsun ama kesmeyi kurmuyorsun bir önceki cevapda yazdım NVIC_init(); fonksiyonunu kullanarak usart RX kesmesini kur ki kesme vektörüne gidebilsin.
http://www.coskunergan.dev/    (Yürümekle varılmaz, lakin varanlar yürüyenlerdir.)

Mucit23

NVIC_Configuration içerisinde usart1 kesmesini kurdum.

void NVIC_Configuration(void)
{
	  NVIC_InitTypeDef NVIC_InitStructure;

			#ifdef  VECT_TAB_RAM
				/*  Vectör kaynagi adresi:  0x20000000 */
				NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
			#else  /* VECT_TAB_FLASH  */
				/*  Vektör kaynagi adresi:  0x08000000 */
				NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
			#endif
			 /* TIM1 güncellenme kesmesi tanitildi */
				NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQChannel;
				NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
				NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
				NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
				NVIC_Init(&NVIC_InitStructure);
			 /* Usart1 Kesmesi Tanitildi         */
                NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQChannel;
                NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
                NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
                NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
			    NVIC_Init(&NVIC_InitStructure);
 
}


Anlamadığım bir durum daha var NVIC_Configuration içeriğini yukarıdaki gibi yaptığımda program derleniyor fakat gerçekte işlemci hiç çalışmıyor.
Fakat usart1 kesmesini kurduğum yeri kaldırırsam eğer çalışmaya başlıyor.
/* Usart1 Kesmesi Tanitildi         */
                NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQChannel;
                NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
                NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
                NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
			    NVIC_Init(&NVIC_InitStructure);

Bu komutlar neden işlemcinin çalışmasına engel oluyor. Yine yaptığım bir hata var anlaşılan

Klein

Örnek burada.
https://www.picproje.org/index.php/topic,43180.new.html#new


Gördüğüm kadarıyla :
USART RX pinini  AF yapmamışsın. Input_Floating yapmışsın.
Ayrıca pinleri USART ile ilişkilendirmemişsin. 
Yukarıdaki linkte örnek mevcut.

X-Fi

alt alta iki kez NVIC_InitStructure kullanmışsın bu yanlış temizlemeden timer ile birleşip usart kesmesi kurmaya başlıyor. farklı fonkiyolara ayır veya ikisini tek kurulumla birleştir.

NVIC_InitStructure.NVIC_IRQChannel = TIM1_UP_IRQChannel | USART1_IRQChannel;   


gibi..
http://www.coskunergan.dev/    (Yürümekle varılmaz, lakin varanlar yürüyenlerdir.)

muhittin_kaplan

mucit in verdiğini bir türlü beceremedim. bende yeni araışlar içerisine girdim. ama onuda beceremedim.
mucit verdiğin kütüphaneyi nasıl kullandığını ve dosyaların işlevlerini vs biraz açıklarmısın.

denediğim kütüphane aşağıdakiydi.
http://en.radzio.dxp.pl/ks0108/

Mucit23

#27
Hocam bendeki kütüphanede yine X-Fi nin expkits için hazırladığı kütüphane. Kendisi anlatsa daha iyi olacak
Ben elimden geldiği kadar anlatayım.

Verdiğim dosyalar içerisinde glcd ile ilgili iki adet dosya var. inc klasörü içerisinde ks0108.h ve src  içerisinde ks0108.c
Kendi projemde .h dosyalarını inc klasörüne .c dosyalarını ise src klasöründe topladım. Ardından stm32F107.h dosyası içerisinde ks0108.h dosyasını programa include ediyorum. Genel olarak tüm tanımlamalarımı burada yapıyorum. stm32f100 için sanırım main.c dosyasının bulunduğu yere ks0108.c ve ks0108.h dosyalarını atıp programa tanıtmanız gerekecek. pin yönlendirmeleri ks0108.h dosyasından yapılıyor. Orada grafik lcd ile ilgili tüm fonksiyonları görebilirsin.

bu arada usart işini yine halledemedim. Dediğim şekilde yapınca program derleniyor ama yine gelen veriyi alamıyorum
o işi sonraya bıraktım. Şimdi benim başım ds1302 ile dertte. Aslında şart değil ama bu çipi arm de çalıştırmam lazım. Amaç Saat değil yani. Biraz piyasaya baktım. Hazır kütüphane bulamayınca oturdum sabahtan bir kütüphane hazırladım bu iş için. (X-Fi'nin yardımı ile) Ama çok saçma sapan sonuçlar alıyorum.

ds1302.c
#include "ds1302.h"
#include "stm32f10x_lib.h"

/*******************************************************************/
#define DATAIN 	((GPIO_ReadInputDataBit(Ds_GPIO,(1<<Ds_DTA)))&0x01)

#define DTA(x) ((x) ? (GPIO_SetBits(Ds_GPIO,(1<<Ds_DTA)))  : (GPIO_ResetBits(Ds_GPIO,(1<<Ds_DTA))) );
#define SCK(x) ((x) ? (GPIO_SetBits(Ds_GPIO,(1<<Ds_SCK)))  : (GPIO_ResetBits(Ds_GPIO,(1<<Ds_SCK))) ); 
#define RST(x) ((x) ? (GPIO_SetBits(Ds_GPIO,(1<<Ds_RST)))  : (GPIO_ResetBits(Ds_GPIO,(1<<Ds_RST))) ); 

#define in   1
#define out  0

/*******************************************************************/
void Ds_Delay(void)
{  			
	unsigned long y;
	for(y=0;y<50;y++); 
}

void TRIS_DATA(char x)	  /*x degeri 0 olursa Ds_DTA cikis, 1 olursa giristir.*/
{			GPIO_InitTypeDef GPIO_InitStructure;
    GPIO_InitStructure.GPIO_Pin = (1<<Ds_DTA);
  	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
if(!x)
  	{GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;}
else 
  	{GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;}
  	GPIO_Init(Ds_GPIO, &GPIO_InitStructure);
}

void Ds1302_Write_Byte(unsigned char x)
{ 
 unsigned char i=0x80;
 do{
   if (x&i)
     {DTA(1);}
     else 
	 {DTA(0);}

   Ds_Delay();
   SCK(1);
   Ds_Delay();
   SCK(0);
   Ds_Delay();
   i>>=1;
  }while(i!=0);
}

unsigned char Ds1302_Read_Byte(void)
{
unsigned char x=0,i=0x80;	
 do
  {
   SCK(1);
   Ds_Delay();
   if (DATAIN) x=(x)|i;
   i>>=1;
   SCK(0);
   Ds_Delay();
  
  }
  while(i!=0);
  SCK(0);
 
  return x;
}

void Ds1302_Write(int saat,int dak,int sn,int gun,int ay,int yil,int hafta)
{
   int x;
   TRIS_DATA(out);  // Data pini Çikisyapildi.
   x=((sn/10)<<4)+(sn%10);sn=x;  //Cevirme islemi yapiliyor
   x=((dak/10)<<4)+(dak%10);dak=x;
   x=((saat/10)<<4)+(saat%10);saat=x;
   x=((gun/10)<<4)+(gun%10);gun=x;
   x=((ay/10)<<4)+(ay%10);ay=x;
   x=((yil/10)<<4)+(yil%10);yil=x;
   x=((hafta/10)<<4)+(hafta%10);hafta=x;
   RST(1);
   Ds1302_Write_Byte(0x8E);
   Ds1302_Write_Byte(0x00);
   RST(0);Ds_Delay();
   RST(1);
   Ds1302_Write_Byte(0xBE);
   Ds1302_Write_Byte(sn);	//Saat degeri Registerlere yukleniyor.
   Ds1302_Write_Byte(dak);
   Ds1302_Write_Byte(saat);
   Ds1302_Write_Byte(gun);
   Ds1302_Write_Byte(ay);
   Ds1302_Write_Byte(yil);
   Ds1302_Write_Byte(hafta);
   Ds1302_Write_Byte(0x80);
   RST(0);Ds_Delay();
}

void Ds1302_Read(int saat,int dak,int sn,int gun,int ay,int yil,int hafta)
{   
    int x; 
    RST(1);
	Ds1302_Write_Byte(0xBF);
	TRIS_DATA(in);
	sn=Ds1302_Read_Byte();
	dak=Ds1302_Read_Byte();
	saat=Ds1302_Read_Byte();
	gun=Ds1302_Read_Byte();
	ay=Ds1302_Read_Byte();
	yil=Ds1302_Read_Byte();
	hafta=Ds1302_Read_Byte();
	x=Ds1302_Read_Byte();

    x=10*((sn&0x70)>>4)+(sn&0x0F);sn=x;
	x=10*((dak&0x70)>>4)+(dak&0x0F);dak=x;
	x=10*((saat&0x70)>>4)+(saat&0x0F);saat=x;
	x=10*((gun&0x70)>>4)+(gun&0x0F);gun=x;
	x=10*((ay&0x70)>>4)+(ay&0x0F);ay=x;
	x=10*((yil&0x70)>>4)+(yil&0x0F);yil=x;
	x=10*((hafta&0x70)>>4)+(hafta&0x0F);hafta=x;
	RST(0);
}


ds1302.h

/*******************Port Tanimlari**********************************/
#define Ds_GPIO GPIOD
#define Ds_SCK 12
#define Ds_DTA 11
#define Ds_RST 10

void Ds_Delay(void);
void TRIS_DATA(char x);
void Ds1302_Write_Byte(unsigned char x);
unsigned char Ds1302_Read_Byte(void);
void Ds1302_Write(int saat,int dak,int sn,int gun,int ay,int yil,int hafta);
void Ds1302_Read(int saat,int dak,int sn,int gun,int ay,int yil,int hafta);


Programın işleyişinde bir problem var.

Edit; ufak bir hata buldum.

Bende ne yaptığımı şaşırdım.

Program düzgün işlemiyor. Anladığım kadarıyla ne yazıp nede okuyabiliyorum. Ds1302 nin clock bacağındaki sinyallere baktım skop ile

upload pictures

Bunu görünce kendimi camdan atasım geldi.

Elinde ds1302 ile ilgili kütüphane olan varmı?

muhittin_kaplan

elimdeki GLCD abg128064a tip ve 5v. malum elimdeki kit 3.3v problem olmayacağını düşünüyorum. ama GPIO çıkışını ölçtüğümde 2,5v civarlarında görüyorum.

Mucit23

Yok hocam 2.5V olmaması lazım. Portun ilgili pini boşta iken 1 durumda kaç volt geliyor?