micheadache
New Member
oh what about just making one Apple appear while thw switch is pressed/off? isit possible?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if((!RE3) && (!m_Switched))
{ m_Switched = true;
RB0 = 1;
printf("Apple \r\n");
printf("Tart \r\n");
} else if(RE3) {
m_Switched = false;
RB0 = 0;}
if((!RE3) && (!m_Switched))
{ m_Switched = true;
RB0 = 1;
printf("/// \r\n");
} else if((RE3) && (m_Switched))
{ m_Switched = false;
RB0 = 0;
printf("Ntu \r\n"); }
if(porta == 0x01)
{ if(portb = 0x01) /*assigns content of portB RB0 to 0x00 for turn-off Led*/
{ portb = 0x00; }
else{ portb = 0x01; } /*assigns content of portB RB0 to 0x01 for turn-on Led*/
}
if((!RE3) && (!m_Switched)) {
if (RB0=0)
{ m_Switched = true;
RB0 = 1;
printf("/// \r\n\0"); //) goes into AT mode
}
if((!RE3) && (!m_Switched))
{ m_Switched = true;
if (RB0==0) {
RB0 = 1;
printf("/// \r\n\0"); } //goes into AT mode
else if(PORTB==0b00000001) {
RB0=0;
RB1=1;
printf("AT*AGND \r\n\0") }
else if(PORTB==0b00000010) {
PORTB==0b00000011;
printf("AT*AGND \r\n\0"); }
} else if((RE3) && (m_Switched))
{ m_Switched = false;
RB0 = 0;
}
#include<pic.h>
#include<htc.h>
#include<conio.h>
#include<stdio.h>
#define XTAL_FREQ 8MHZ
void init_rs232();
void putChar( unsigned char ch);
#define MHZ *1000L
#define XTAL_FREQ 8MHZ
#define DelayUs(x) { unsigned char _dcnt; \
_dcnt = (x)/((12MHZ)/(XTAL_FREQ))|1; \
while(--_dcnt != 0) \
continue; }
int m_Count;
#define true 1
#define false 0
void main()
{
OSCCON= 0x75; //8Mhz High Freq Clock, can be fine tuned using OSCTUNE
TRISE = 0x08;
TRISB = 0xF0;
ADCON1 = 0x07;
init_rs232();
static bit m_Switched = false;
while(1){
//Global or main function variable.
if((!RE3) && (!m_Switched))
{ m_Switched = true;
m_Count++;
switch(m_Count){
case 1:
RB0 = 1;
printf("/// \r\n\0");
case 2:
RB1=1;
}
}
}
}
void init_rs232()
{
BRGH = 1; // high baud rate to avoid baud rate error & bcos 16bit achieve slow baud rates fr fast osc freq
BRG16 = 0;
SPBRG = 8; // Fosc=8Mhz, ,16, BR=57600
TX9 = 0; // 9bits=1: 8-bit=0
SYNC = 0; // asynchronous
SPEN = 1; // enable serial port pins
TXEN = 1; // enable the transmitter & (automatically)TXIF=1
CREN = 1; // enable reception
SREN = 0; // no effect
TXIE = 0; // disable tx interrupts
RCIE = 0; // disable rx interrupts
RX9 = 0; // ninebits?1:0,,,8- or 9-bit reception
}
if((!RE3) && (!m_Switched))
{ m_Switched = true;
m_Count=0
m_Count++;
switch(m_Count){
case 1:
RB0 = 1;
printf("/// \r\n\0"); // AT mode
break;
case 2:
RB1=1;
printf("AT*AGND \r\n\0"); // search fr new device
break;
case 3:
RB0=1;
RB1=1;
break; }
void putch(unsigned char byte)
{ /* output one byte */
while(!TXIF) /* set when register is empty */
continue;
TXREG = byte;
}