Username:     
Password:     
             

Projects
Primer1 PWM analysis and CAN! V1.0
 
Measures the frequency and the PWM ratio. Project Primer1 PWM analysis without Circle OS +CAN +Display +More Fronts +Images +background image +extern interrupt

Code size: Author:Matthias
Source files included:yes Version:V1.0
Use circleOS:no Creation date:2010-04-26 12:41:04
Hardware modification:yes Modification date:2010-04-26 13:16:19
Based on the STM32 Primer:Primer1
   
Downloads:608 Views:20991
   
Vote:
Average ratings:0/5 (0 rates)

Download:    Primer1-PWM-analysis-and-CAN-V1.0.zip (1209 KB)

Description:

/********************* (C) COPYRIGHT RAISONANCE S.A.S. *********************************/
/********************* (C) COPYRIGHT STMicroelectronics ********************************/
/********************* (C) Matthias ****************************************************/
/* optimized for PRIMER1, extended and amended by Matthias email webmaster@tg-info.de

Project "Primer1 PWM analysis"

!! Hardware change !!
There must be two interruptions tracks and two new connections are soldered.
The Can driver is connected the external.
see: "_Hardware_change\Primer_bot.png"

What goes
- LEds
- CAN
- Vbat
- Temp sensor
- Shutdown
- 3 axis acceleration sensor
- Backlight ON/Off
- Display
- More fronts         generate with "Primer_Fonts_V1.1.xls"
- Background image    Background image is "Pictures/bmp_background_image.h" generate with "Create_background_image.xls"
- Symbols images with Transparent  generate with "Create_BMP_header.xls"


/* ------------------------------------------------------------------------------------*/
/* Functions and Variable Description                                                  */
/* ------------------------------------------------------------------------------------*/
/* ------------ AccelSensor.c ------------------------------------------------------------- */
   extern void  AccelSensor_Init_Sensor(void);              // needs to be started once
   extern void  AccelSensor_Read_Sensor(void);              // After the call the following variables are set
   extern s16   AccelSensor_X_Roh_s16;                      // Accel Sensor X unfiltered
   extern s16   AccelSensor_Y_Roh_s16;                      // Accel Sensor Y unfiltered
   extern s16   AccelSensor_Z_Roh_s16;                      // Accel Sensor Z unfiltered
   extern s16   AccelSensor_X_Fil_s16;                      // Accel Sensor X filtered
   extern s16   AccelSensor_Y_Fil_s16;                      // Accel Sensor Y filtered
   extern s16   AccelSensor_Z_Fil_s16;                      // Accel Sensor Z filtered
/* ------------ BackLight.c --------------------------------------------------------------- */
   extern void  BackLight_On(void);                         // turn on  the LCD backlight
   extern void  BackLight_Off(void);                        // turn off the LCD backlight
/* ------------ Buzzer.c --------------------------------------------------------------- */
enum            BUZZER_mode
{
   BUZZER_UNDEF      = -1,         /*!<  undefined mode for buzzer            */
   BUZZER_OFF        =  0,         /*!<  The buzzer is put off.               */
   BUZZER_ON         =  1,         /*!<  The buzzer is put on.                */
   BUZZER_SHORTBEEP  =  2,         /*!<  Make buzzer to bip for a short time  */
   BUZZER_LONGBEEP   =  3,         /*!<  Make buzzer to bip for a long time   */
   BUZZER_PLAYMUSIC  =  4          /*!<  Make buzzer to play a music          */
};
   extern void  Buzzer_Handler(void);
   extern void  Buzzer_SetMode( enum BUZZER_mode mode );
   extern void  Buzzer_PlayMusic (const u8 *melody );
/* ------------ CAN.c --------------------------------------------------------------------- */
   extern void  USB_LP_CAN1_RX0_IRQHandler(void);           // Interrupt when message is received can
   extern void  CAN_Send_Msg_401(void);                     // sample
/* ------------ CAN_Debug.c --------------------------------------------------------------- */
   extern void  CAN_Debug_Send_All_Primer_Data(void);       // Sends several can messages with the sensors values
/* ------------ Configuration.c ----------------------------------------------------------- */
   extern void  Configuration_RCC(void);                    // The name says it all
   extern void  Configuration_GPIO(void);                   // The name says it all
   extern void  Configuration_NVIC(void);                   // The name says it all
   extern void  Configuration_SysTick(void);                // The name says it all
   extern void  Configuration_ADC(void);                    // The name says it all
   extern void  Configuration_SPI(void);                    // The name says it all
   extern void  Configuration_CAN(void);                    // The name says it all
   extern void  Configuration_Timer(void);                  // The name says it all
/* ------------ EXTI0_IRQHandler.c -------------------------------------------------------- */
   extern void  EXTI2_IRQHandler(void);                     // Interrupt on EXTI0
   extern u16   EXTI2_Cycle_Time_Count_u16;                 // interrupt counter
   extern u16   EXTI2_High__Time_Count_u16;                 // interrupt counter
   extern u16   EXTI2_Counter_u32;                          // interrupt counter
/* ------------ Font.c -------------------------------------------------------------------- */
   extern void  Font_Set_Font_u8( u8 Font );                // to change the font
   #define      Font_7x8                      1             // available fonts
   #define      Font_7x11                     2             // available fonts
   #define      Font_10x16                    3             // available fonts
   #define      Font_16x16                    4             // available fonts
   #define      Font_Symbols                  5             // available fonts
   #define      Font_BigNumber                6             // available fonts
   #define      Font_Primer                   0             // available fonts
   extern u8    Font_Width_u08;                             // Font width of the selected font
   extern u8    Font_Height_u08;                            // Font height of the selected font
   extern u8    Font_Starts_u08;                            // first sign of the selected font
   extern u8    Font_Ends_u08;                              // last character of the selected font
   extern u8    Font_Scale_u08;                             // Scale of the selected font
   extern bool  Font_Transparent_Bol;                       // if true, the background image is not overwritten. Background image is "Pictures/bmp_background_image.h generate" with "Create_background_image.xls"
   extern u16   Font_Text_Color_u16;                        // Text color of the selected font
   extern u16   Font_BGnd_Color_u16;                        // Background color of the selected font
   extern u8*   Font_Character_Table_P08;                   // pointer on the current font
/* ------------ Lcd.c --------------------------------------------------------------------- */
   extern void  LCD_Init(void);                                                                 // needs to be started once
   extern void  LCD_Draw_Surface    ( u8 x , u8 y , u8 width, u8 height, u16 color );           // drawing surface
   extern void  LCD_Draw_Rectangle  ( u8 x , u8 y , u8 width, u8 height, u16 color );           // drawing rectangle
   extern void  LCD_Draw_Line       ( u8 x1, u8 y1, u8 x2   , u8 y2    , u16 color );           // Draw line
   extern void  LCD_Delite_Line     ( u8 x1, u8 y1, u8 x2   , u8 y2                );           // restore delete line painted against the background image
   extern void  LCD_Draw_BW_Image   ( u8 x , u8 y , u8 width, u8 height, const u8*  imageptr ); // draw black and white picture
   extern void  LCD_Draw_Color_Image( u8 x , u8 y , u8 width, u8 height, const u16* imageptr ); // Draw color image
   extern void  LCD_Write_Text      ( u8 x , u8 y , const u8* Text, u8 Text_Len    );           // Write text, textsetup see Font.c
   extern void  LCD_background_image( void   );                                                 // see folder "_Background_image"
   extern void  LCD_DisplayRotate   ( u8 Pos );
/* ------------ Led.c --------------------------------------------------------------------- */
   extern void  Led_Set_Value_u8(u8 Value);              // Bit 0 is green, Bit 1 is red
   extern void  Led_Green_On(void);                      // The name says it all
   extern void  Led_Green_Off(void);                     // The name says it all
   extern void  Led_Red_On(void);                        // The name says it all
   extern void  Led_Red_Off(void);                       // The name says it all
   extern void  Led_Green_and_Red_On(void);              // The name says it all
   extern void  Led_Green_and_Red_Off(void);             // The name says it all
/* ------------ Main.c -------------------------------------------------------------------- */
   extern bool  Main_System_Init_Finished_Bol;       // Once all configuration is done it is set to true
   extern       RCC_ClocksTypeDef RCC_Clocks;
   extern void  Pause_80us(void);
   extern void  Pause_01us(void);
/* ------------ Pushbutton.c -------------------------------------------------------------- */
   extern void  Pushbutton_Read(void);                    // After the call the following variables are set
   extern u8    Pushbutton_Push_Counter_u08;         // press in the variable increased by one, so that the press time can be evaluated (max 250)
/* ------------ Shutdown.c ---------------------------------------------------------------- */
   extern void  Shutdown_Me(void);                          // After the call, the primer off
/* ------------ Task.c -------------------------------------------------------------------- */
   extern void  Task_delay_ms(volatile uint32_t nTime);     // ms delay function
/* ------------ TempSensor.c -------------------------------------------------------------- */
   extern void  TempSensor_Read_Sensor(void);               // After the call the following variables are set
   extern s16   TempSensor_Value_Fil_s16;                   // Temperature filter 100 corresponds to 10 degrees
   extern s16   TempSensor_Value_Roh_s16;                   // Temperature unfiltered
   extern u16   TempSensor_Value_Spg_u16;                   // Voltage sensor unfiltered
/* ------------ Vbat.c -------------------------------------------------------------------- */
   extern void  Vbat_Read_Vbat(void);                       // After the call the following variables are set
   extern u16   Vbat_mV_Fil_u16;                        // Vbatt filtered
   extern u16   Vbat_mV_Roh_u16;                        // Vbatt unfiltered
   extern u16   Vbat_Charging_mVoltage_Fil_u16;             // Charging Voltage filtered
   extern u16   Vbat_Charging_mVoltage_Roh_u16;             // Charging Voltage unfiltered



Project comments


To add comments, please register you.