È molto strano che a te funzioni e a me no!
Non ho tutti i torti, è Keil che mi tira scemo
Comunque, ho provato a riprendere il programma che mi avevi mandato tu, e strano ma vero questo funziona !
Anche se come hai potuto notare tu stesso, non faccio nulla di particolare.
Ma bando alle ciance: questo funzione, QUINDI, utilizzo questo come base!
Ho provato a scrivere questo programmino IO e..... FUNZIONA ! anche se per ora accendo e spengo alternativamente solo due led.
Ti allego il main,nel caso volessi dargli un'occhiata :
- Codice: Seleziona tutto
#include "stm32f10x_lib.h"
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
//-----------------------------------------------------------------------------
void USART1PrintChar(char ch)
{
// Aspetta che il registro di trasmissione sia libero
while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);
USART_SendData(USART1,ch);
}
//------------------------------------------------------------------------------
void Delay(long nCount)
{
for(; nCount != 0; nCount--);
}
//-----------------------------------------------------------------------------
void initSystem(void)
{
//Fornisco il clock a GPIOC
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
//Configuro il pin 9 (LED3)
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
// Fornisce il clock all' USART1 per metterla in funzione
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
// Configura il piedino di RX come input floating
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configura il pin TX come funzione alternativa push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// Configura l' USART 1200 baid, 8 bit, 1 stop, no parità nessun controllo hardware
USART_InitStructure.USART_BaudRate = 1200;
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;
// Configura l' USART1
USART_Init(USART1, &USART_InitStructure);
// Abilita l' USART1
USART_Cmd(USART1, ENABLE);
}
//-----------------------------------------------------------------------------
int main(void)
{
initSystem();
while(1)
{
GPIOC->BSRR = GPIO_Pin_9;
Delay(0xAFFFF);
GPIOC->BRR = GPIO_Pin_9;
Delay(0xAFFFF);
}
}

Elettrotecnica e non solo (admin)
Un gatto tra gli elettroni (IsidoroKZ)
Esperienza e simulazioni (g.schgor)
Moleskine di un idraulico (RenzoDF)
Il Blog di ElectroYou (webmaster)
Idee microcontrollate (TardoFreak)
PICcoli grandi PICMicro (Paolino)
Il blog elettrico di carloc (carloc)
DirtEYblooog (dirtydeeds)
Di tutto... un po' (jordan20)
AK47 (lillo)
Esperienze elettroniche (marco438)
Telecomunicazioni musicali (clavicordo)
Automazione ed Elettronica (gustavo)
Direttive per la sicurezza (ErnestoCappelletti)
EYnfo dall'Alaska (mir)
Apriamo il quadro! (attilio)
H7-25 (asdf)
Passione Elettrica (massimob)
Elettroni a spasso (guidob)
Bloguerra (guerra)



