Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#define FCY 4000000ULL
#include <libpic30.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdbool.h>
#include "app.h"
#define ONE_VOLT 310
#define ONE_TENTH_VOLT 31
#define ONE_HUNDREDTH_VOLT 3
int runnin;
// *****************************************************************************
// *****************************************************************************
// Section: File Scope Variables and Functions
// *****************************************************************************
// *****************************************************************************
char str[];
void Update_LCD ( void ) ;
void SYS_Initialize ( void ) ;
extern void ConvertADCVoltage ( unsigned int ) ;
extern void Hex2Dec ( unsigned char ) ;
void p1();
void p2();
void p3();
void p4();
void r_program();
int i;
int gray;
int num;
APP_DATA appData = {
.messageLine1 = "Explorer 16 MyVer" ,
.messageLine2 = "Press S3 to cont" ,
.messageTime = "Time 00: 00: 00 " ,
.messageADC = " Pot = 0.00 Vdc "
} ;
// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
int main ( void )
{
LED_Enable(LED_D3);
LED_Enable(LED_D4);
LED_Enable(LED_D5);
LED_Enable(LED_D6);
LED_Enable(LED_D7);
LED_Enable(LED_D8);
LED_Enable(LED_D9);
LED_Enable(LED_D10);
LED_Off(LED_D9);
//SYS_Initialize ( ) ;
//ADC_SetConfiguration ( ADC_CONFIGURATION_AUTO_SAMPLE_CONVERT ) ;
int runnin = 1;
LATA = 0;
/* Infinite Loop */
while ( 1 )
{
__delay_ms(5000);
//char str[20];
//sprintf(str, "zmien program %d", runnin);
//LCD_PutString(str, sizeof(str));
if(BUTTON_IsPressed(BUTTON_S3))
{
runnin++;
}
else if (BUTTON_IsPressed(BUTTON_S4))
{
runnin--;
}
if( runnin > 9)
{
runnin = 1;
}
else if ( runnin < 1)
{
runnin = 9;
}
LCD_ClearScreen();
char str[20];
sprintf(str, "program %d", runnin);
LCD_PutString(str, sizeof(str));
r_program(runnin);
LATA = 0;
runnin+=1;
__delay_ms(1000);
//LED_On(LED_D10);
__delay_ms(500);
};
}
void r_program(int runnin)
{
switch(runnin)
{
case 1:
p1();
break;
case 2:
p2();
break;
case 3:
p3();
break;
case 4:
p4();
break;
case 5:
//prog5();
break;
case 6:
//prog6();
break;
case 7:
//prog7();
break;
case 8:
//prog8();
break;
case 9:
//prog9();
break;
default:
//prog1();
break;
}
}
void p1(){
for(int i = 0; i <= 255; i++)
{
LATA = i;
__delay_ms(500);
if(BUTTON_IsPressed(BUTTON_S3))
{
return;
}
else if (BUTTON_IsPressed(BUTTON_S4))
{
return;
}
}
}
void p2(){
for(int i = 255; i >= 0; i--)
{
LATA = i;
__delay_ms(500);
}
}
void p3(){
for(int i = 0; i <= 255; i++)
{
LATA = i ^ (i >> 1);
__delay_ms(500);
}
}
void p4() {
for(int i = 0; i <= 255; i++) {
unsigned int gray = i ^ (i >> 1);
unsigned int num = gray;
while (num >>= 1) {
gray ^= num;
}
LATA = gray;
__delay_ms(500);
}
}
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team