caramoan tour package

caramoan tour package

Author Topic: Q&A sa CCS C  (Read 7213 times)

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #40 on: February 28, 2009, 03:51:14 PM »
dapat pala ganito:

Code: [Select]
short RTCC_flag;
int msec4ms,sec,min;   

#int_RTCC
void  RTCC_isr(void)
{
   msec4ms++;        //increment every 4ms
                     // 1 sec  = 25*4ms
   if(msec>=25)               
   {
      msec = 0;
      sec++;
      if (sec>=60)
      {
         sec=0;
         min++;
         if(min>=count_TIME)
         {
            min =0;
            RTCC_flag = TRUE;
         }
      }
   }
   //... multiplexed seven segment rountine here.
}

san mo naman ginamit to sir sa routine  msec4ms++;        //increment every 4ms?
if you think you can or think you can't, you're probably right -h.ford

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #40 on: February 28, 2009, 03:51:14 PM »

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #41 on: February 28, 2009, 03:57:41 PM »
another issue... hehehe ;D ;D ;D

pwede din siguro ilagay yan sa interrupt uli. may interrupt on change ang PIC16F84 sa RB (4:7). or ilalabas nalang natin yung led matrix refreshing mo. therefore, driving the main while loop to operate at high speed. we were actually trying not tor fire the flag for RTCC to often.

ano ba kabilis ang transition ng RB7 and RB6?
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #41 on: February 28, 2009, 03:57:41 PM »

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #42 on: February 28, 2009, 04:00:29 PM »
san mo naman ginamit to sir sa routine  msec4ms++;        //increment every 4ms?

kasi, ang RTCC_isr ay mag-aactivate every overflow ng timer0. so aandar ang ISR ever 4ms. i just did make a whole of 1 sec bago mag-increment ang sec variable. since may 25 4ms sa isang second,
Quote
msec4ms++;        //increment every 4ms
                     // 1 sec  = 25*4ms
if(msec>=25)               
{
      msec = 0;
      sec++;
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #42 on: February 28, 2009, 04:00:29 PM »

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #43 on: February 28, 2009, 04:05:34 PM »
kasi, ang RTCC_isr ay mag-aactivate every overflow ng timer0. so aandar ang ISR ever 4ms. i just did make a whole of 1 sec bago mag-increment ang sec variable. since may 25 4ms sa isang second,

baka namiss mo to sir marce

msec4ms++;        //iniincrement mo to
                     
// 1 sec  = 25*4ms
if(msec>=25)  // pero hindi nmn msec4ms ang condition mo dito
if you think you can or think you can't, you're probably right -h.ford

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #43 on: February 28, 2009, 04:05:34 PM »

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #44 on: February 28, 2009, 04:14:10 PM »

porta = ones;    //display whatever the content of ones to porta
portb = 0x01;    //turn on the 7-seg connected at rb0
delay_ms(4);     //for POV
porta = tens;    //display whatever the content of ones to porta
portb = 0x02;   //turn on the 7-seg connected at rb1
delay_ms(4);    //for POV
porta = huns;   //display whatever the content of ones to porta
portb = 0x04;   //turn on the 7-seg connected at rb2
delay_ms(4);   //for POV

kung ganito dapat ang multiplexing ko, papano na kaya to gagawin pag may rtcc interrupt?
if you think you can or think you can't, you're probably right -h.ford

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #44 on: February 28, 2009, 04:14:10 PM »

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #45 on: February 28, 2009, 04:18:23 PM »
hehe

ang bait ni sir marce, napapagtyagaan nyako dito sa thread.hehe
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #46 on: February 28, 2009, 04:44:12 PM »
baka namiss mo to sir marce

msec4ms++;        //iniincrement mo to
                     
// 1 sec  = 25*4ms
if(msec>=25)  // pero hindi nmn msec4ms ang condition mo dito



hehehe... yan di ko naman kasi kinucompile :D

parang dapat gumamit na tayo ng RB_ISR. pero di pa kasi ako nakakagamit nito... heheh ;D

at hingi ka din ki yus high valued oscillator. (or pabili ka)
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #47 on: February 28, 2009, 04:59:02 PM »

hehehe... yan di ko naman kasi kinucompile :D

parang dapat gumamit na tayo ng RB_ISR. pero di pa kasi ako nakakagamit nito... heheh ;D

at hingi ka din ki yus high valued oscillator. (or pabili ka)

binigyan nako nyan ni yus ng xt osc kaso puro surface mount wala akong pangsolda nun eh.hehe

naisip ko rin yan sir marce na magRB int. mamaya itatry ko to sa bahay pag uwi ko.
if you think you can or think you can't, you're probably right -h.ford

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #48 on: March 01, 2009, 02:30:52 PM »
sir marce, naglagay na lang ako ng #int_rb para sa pag increment, decrement at sa pagwrite sa eeprom. hindi na lang ako mag aantay ng 10mins kasi ang hirap nung code, diko na masyadong gets. newbie ako sa ccsc e.


O.T.bakit kaya nung nagtry ako sa proteus ang multiplexing ng 7SDisplay hindi nmn nagkakaPOV. paisaisa pa rin silang nagdidisplay. 4ms per segment na nga yung refresh rate ko e. o this is just another limititation of PROTEUS? sa scrolling display ganun din.di naman nakikita yung message pero pag sa actual circuit ok naman.
if you think you can or think you can't, you're probably right -h.ford

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #49 on: March 03, 2009, 10:35:14 AM »
why does this code generate a lot of errors?

#include<16f84a.h>
#include"lcd.c"
#fuses xt,noput,noprotect,nowdt
#use delay(clock = 4000000)

void main()
{
         lcd_init();
     
         while(true)
       {
         lcd_gotoxy(1,1);
         lcd_putc(kent);
       }

}
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #50 on: March 03, 2009, 11:51:15 AM »
here is the corrected (and the correct one!) hehehe ;D
Quote
#include<16f84a.h>

#fuses hs,noput,noprotect,nowdt
#use delay(clock = 4000000)       //HS na to & dapat mauna kasi kailangan to ng "lcd.c"
#include "lcd.c"

void main()
{
         lcd_init();
     
         while(true)
       {
         lcd_gotoxy(1,1);
         lcd_putc("\fmarcelino pogi!");
       }
}
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #51 on: March 03, 2009, 12:11:48 PM »
a ganun pala yun sir marce.hehe thnx

pahabol, sir marce pwede po bang papost nung example mo sa uart. kasama na yung circuit sa proteus. diko kasi alam ang connection e. =)
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #52 on: March 03, 2009, 12:51:41 PM »
Code: [Select]
#include <16F84A.h>

#FUSES NOWDT,HS,NOPUT,NOPROTECT

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8)
//note of the directions of the pins

void main()
{
   printf("start");
   while(TRUE) {
      printf( "%c",getc()+1 ); //should return the next character in the ascii.
                               //pressing 'a', returns 'b'.
                               //'space' to  '!'
   }
}


"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #53 on: March 03, 2009, 12:54:39 PM »
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #54 on: March 04, 2009, 10:22:04 AM »
^^ hehe astig tong sample mo sir marce ah. tanong ko lang po, identified no po agad ng program na yung iniinput mo is an ascii? jan po sa code mo sir marce?


another inquiry:

i tried to use switch in my program, parang ganito po

 
    printf("enter a letter:\n\r");
    while(true){   
        c = getch();
       
        switch(c)
        {
           case 'a':
                 output_b(0x01);
                 break;
           case 'b':
                 output_b(0x02);
                 break;
           case 'c':
                 output_b(0x04);
                 break;
           default:
                 break;
           }
}

though nagccompile po sya at nag aapear talaga sa virtual terminal sa proteus yung message, di naman sya nag aaccept ng input at hiundi naman umiilaw yung led sa pin na nakalagay sa bawat case.

i hope nakikita nyo yong gusto kong gawin. papano ko po kaya mococontrol ang ports/pins ng MCU using uart. TIA
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #55 on: March 04, 2009, 10:40:14 AM »
Kilala na yata ng compiler ang ascii, kaya need not to worry actually. hehehe ;D

pwede patingin lahat nung code mo?
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #56 on: March 04, 2009, 11:22:10 AM »
Code: [Select]
#include <16F628A.h>

#FUSES NOWDT,HS,NOPUT,NOPROTECT

#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_b3,rcv=PIN_b2)

void main()
{
    printf("enter a letter:\n\r");
    while(true)
    {   
        c = getch();
       
        switch(c)
        {
           case 'a':
                 output_b(0x01);
                 break;
           case 'b':
                 output_b(0x02);
                 break;
           case 'c':
                 output_b(0x04);
                 break;
           default:
                 break;
         }
     }
}

yan po yung natatandaan ko sa code.hehe nasa shop kasi ako e. diko nasave sa usb yung code ko sa pc.
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #57 on: March 04, 2009, 11:50:07 AM »
mg komentos:
pimero: you did not declare the char c;
segundo: it would have been better if you did make use the hardware uart which Pins RB1 and RB2 for rx and tx, respectively.
tarsera: i would avoid using the pins as i/o pins when have been declared as pins for UART? in your case, rcv=pin_b2 is being used in case 'b';
kwarta: output_b(0x03) = 0b00000011; in this case, pin for UART will also be affected.

check mo na lang.
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Offline clarkent

  • Lead Acid Battery
  • *******
  • Posts: 505
  • Pogi/Ganda Points: 20
  • Gender: Male
  • iehs
Re: Q&A sa CCS C
« Reply #58 on: March 04, 2009, 11:59:45 AM »
ay mali,hehe hardware po yung gamit ko sir. rb1 and rb2 tapos yung leds ko nakaconnect sa porta. wala tlga sir.hehe

#include <16F628A.h>

#FUSES NOWDT,HS,NOPUT,NOPROTECT

#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_b2,rcv=PIN_b1)

void main()
{
    char c;
    printf("enter a letter:\n\r");
    while(true)
    {   
        c = getch();
       
        switch(c)
        {
           case 'a':
                 output_a(0x01);
                 break;
           case 'b':
                 output_a(0x02);
                 break;
           case 'c':
                 output_a(0x04);
                 break;
           default:
                 break;
         }
     }
}

yan po tala yung code.hehe
if you think you can or think you can't, you're probably right -h.ford

Offline marcelino

  • Moderator
  • Solar Power Satellite
  • *****
  • Posts: 6016
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Q&A sa CCS C
« Reply #59 on: March 04, 2009, 12:31:54 PM »
i copy-pasted pour code. nagwowork baga!!!
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Q&A sa CCS C
« Reply #59 on: March 04, 2009, 12:31:54 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com