caramoan tour package

caramoan tour package

Author Topic: Request Zilog Encore! Microcontroller codes here (C Only)  (Read 15712 times)

Offline paranz

  • Moderator
  • Nuclear Reactor
  • *****
  • Posts: 4525
  • Pogi/Ganda Points: 177
  • Gender: Male
  • 1/4W resistor specialist
    • RapidSignal Electronics
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #20 on: May 07, 2009, 06:10:30 AM »
^

i tried this code for testing

Code: [Select]

temp = tolower(fifo_getch()); //get 1 character from buffer
if (temp == 'a')
PDOUT ^= 0x08; //toggle PD3
if (temp == 's')
PDOUT ^= 0x10; //toggle PD4


ok lang naman ang fifo_getch().

Try mo i-debug sis, tapos view mo sa watch window ang rxfifo na array
PIC16 Programming Tutorial using MPLAB and Hi-Tech C
www.rapidsignalph.com/tutorials/pic16-tutorials

Arduino & gizDuino Tutorials
www.rapidsignalph.com/tutorials/arduino-tutorials

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #20 on: May 07, 2009, 06:10:30 AM »

Offline Donopot

  • CR2032 Battery
  • **
  • Posts: 33
  • Pogi/Ganda Points: 0
  • Gender: Male
  • Just Like in the Picture
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #21 on: May 07, 2009, 09:07:00 PM »
sir ipapacheck ko lang poh kung noh ung mali dito sa program na inedit namin. for 40pins poh kasi ung program code pro 44pins gamit namin kya iniba ko...

Code: [Select]
#include <ez8.h>
#include <sio.h>

#define RELOAD_VALUE 18432 //PWM period (sec.) = (RELOAD x Prescaler)/system clock (Hz)
#define PWM_VALUE1 9216 //7.5% duty cycle
#define PWM_VALUE2 4608 //10% duty cycle
#define PWM_VALUE3 13824 //5% duty cycle

#define TMODE 0x03 //Timer mode is PWM mode
#define PRESCALER 0x04 //prescaler = 4

void init_PWM(void) //configure Timer 1
{
DI ();
T1CTL &= ~0x80; //Disable Timer 1
T1CTL |= (PRESCALER << 3) | TMODE; //Prescaler = 0, PWM mode
T1CTL |= 0x40; //TPOL = 1. PC1/T1OUT output set to high
//PWM output is initially high and
//toggle to low when PWM_VALUE is reached
T1H = 0x00; ` //initial value is 1
T1L = 0x01;

T1PWMH = (PWM_VALUE1 >> 8); //PWM_VALUE loaded, set duty cycle
T1PWML = (PWM_VALUE1 & ~0xFF00);

T1RH = (RELOAD_VALUE >> 8); //RELOAD_VALUE loaded, set PWM period
T1RL = (RELOAD_VALUE & ~0xFF00);

IRQ0ENH &= ~0x40; //Timer 1 interrupt disabled
IRQ0ENL &= ~0x40;

PCDD |= 0x20; //PCI/T1OUT pin is output
       PCAF |= 0x20; //turn on alternate function of PC1,

T1CTL |= 0x80; //Enable Timer 1
EI ();
}

void init_pushbuttons(void)
{
PDDD |= 0x04; //PD2 is input
PDAF &= ~0x04;

PDDD |= 0x08; //PC3 is input
PDAF &= !0x08;
}

void main ()
{
unsigned char val = 0x00
init_pushbuttons(); //intialize PC2 and PD1 as input pins
init_PWM(); //initialize timer1, PWM mode

while(1)
{
if val = PDIN & 0x04; //if pushbutton1 is pressed
{
T1PWMH = (PWM_VALUE2 >> 8); //change to 10% duty cycle
T1PWML = (PWM_VALUE2 & ~0xFF00); //servomotor turn counter
//clock-wise (CCW)
}
if val = PDIN & 0x08; //if pushbutton2 is pressed
{
T1PWMH = (PWM_VALUE# >> 8); //change to 5% duty cycle
T1PWML = (PWM_VALUE3 & ~0xFF00); //servomotor turn clock-wise (CW)
}
}
}

Never to give up and never to lose hope... Happiness is a road that is always under construction..

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #21 on: May 07, 2009, 09:07:00 PM »

Offline 'yus

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4251
  • Pogi/Ganda Points: 299
  • Gender: Male
  • hw -> fw -> sw
    • yus' projects
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #22 on: May 14, 2009, 07:17:06 PM »
pa'no mag-code ng mga interrupts (e.g. adc-conversion-complete interrupt)? ???
anong ibig sabihin nung mga "#pragma" sa code? ???
join  - Philippine Electronics and Robotics Enthusiasts Club - www.philrobotics.com

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #22 on: May 14, 2009, 07:17:06 PM »

Offline paranz

  • Moderator
  • Nuclear Reactor
  • *****
  • Posts: 4525
  • Pogi/Ganda Points: 177
  • Gender: Male
  • 1/4W resistor specialist
    • RapidSignal Electronics
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #23 on: May 15, 2009, 10:01:54 AM »
^
the line

Code: [Select]
#pragma interrupt
tells the compiler that the function following the #pragma line is an ISR.

AFAIK, #pragma lines are preprocessor directives that have specific meaning depending on the compiler


PIC16 Programming Tutorial using MPLAB and Hi-Tech C
www.rapidsignalph.com/tutorials/pic16-tutorials

Arduino & gizDuino Tutorials
www.rapidsignalph.com/tutorials/arduino-tutorials

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #23 on: May 15, 2009, 10:01:54 AM »

Offline Donopot

  • CR2032 Battery
  • **
  • Posts: 33
  • Pogi/Ganda Points: 0
  • Gender: Male
  • Just Like in the Picture
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #24 on: May 15, 2009, 10:24:50 PM »
sir what is the purpose of the exclamatory point in this program

if (!(PAIN & 0x04)) {
      delay(); delay(); delay(); delay(); delay(); delay(); delay(); delay(); delay();
       T1PWMH = 0x00;   T1PWML = 0x48; //
       T2PWMH = 0x00;   T2PWML = 0x48; //
       }
Never to give up and never to lose hope... Happiness is a road that is always under construction..

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #24 on: May 15, 2009, 10:24:50 PM »

Offline 0b00000111

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6130
  • Pogi/Ganda Points: 398
  • There is no delight in owning anything unshared.
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #25 on: May 15, 2009, 10:30:28 PM »
most commonly gamit ang ! sa mga if statements... eto example para mas madali maintindihan ang gamit

!(zero) = 1
!0=1

!(any number not equal to 0) = 1
!5=0
!1=0
!10000=0


the same ang
if (!(PAIN & 0x04)) {
sa
if ((PAIN & 0x04)==0) {
E-Gizmo Mechatronix Central: www.e-gizmo.com

Tel #: (63)(2) 536-3378
Globe +63915-973-7691
Smart +63921-779-0748

Location Map

YM: julie.egizmo  aka Born2BeWired  ;D

Offline abyssinian

  • Size AAA Battery
  • ***
  • Posts: 60
  • Pogi/Ganda Points: 0
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #26 on: June 27, 2009, 09:56:50 PM »
good day po mga sir at ma'am. gagamitin po sana namin sa undergraduate project namin yung Z8FMC16100 ng zilog para magkontrol ng anim na servomotors. meron pong 6 pwm channels ang MCU na ito, ang problema ko po ay hindi ko po alam kung paano gamitin yung pwm channels na yun. meron po ba ditong nakagamit na ng MCU na ito? specially po yung pwm channels. maraming maraming salamat po. :D

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2864
  • Pogi/Ganda Points: 204
  • Gender: Male
    • Tiktakx's Blog
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #27 on: July 04, 2009, 12:50:53 AM »
request naman po ng code ng pagamit ng internal ADC ng encore xp, kunyari babasahin ko yung 3 sensor ng mobot tnx ;D
8051 stuff

Offline SpongeBob

  • Lead Acid Battery
  • *******
  • Posts: 660
  • Pogi/Ganda Points: 33
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #28 on: July 04, 2009, 02:40:21 PM »
request naman po ng code ng pagamit ng internal ADC ng encore xp, kunyari babasahin ko yung 3 sensor ng mobot tnx ;D
Ano sini-sense mo sir? Kung black lines di na kailangan ang ADC.
May tutorial si sir paranz about Zilog Encore search mo lang.

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2864
  • Pogi/Ganda Points: 204
  • Gender: Male
    • Tiktakx's Blog
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #29 on: July 04, 2009, 05:13:43 PM »
opo sir, yung black lines, gusto ko sana i diretso na sa ADC ng MCU yung pagsense, tsaka gusto ko po sana maglagay ng pang sense din ng ambient light for compensation kaya gusto ko sana sa ADC na i feed
8051 stuff

Offline SpongeBob

  • Lead Acid Battery
  • *******
  • Posts: 660
  • Pogi/Ganda Points: 33
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #30 on: July 04, 2009, 05:36:07 PM »
opo sir, yung black lines, gusto ko sana i diretso na sa ADC ng MCU yung pagsense, tsaka gusto ko po sana maglagay ng pang sense din ng ambient light for compensation kaya gusto ko sana sa ADC na i feed

Gamitan mo na lang ng comparator with adjustable threshold para madali sa programming, pwede rin ADC pero medyo complicated nang konti. Appnotes using ADC,
http://www.zilog.com/docs/z8encorexp/appnotes/an0223.pdf

Offline tiktak

  • Gas Turbine
  • **
  • Posts: 2864
  • Pogi/Ganda Points: 204
  • Gender: Male
    • Tiktakx's Blog
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #31 on: July 04, 2009, 05:41:15 PM »
thanks po sir, nasimulan ko nadin po yung program, i post ko dito later if napagana ko ng maayos ;D
8051 stuff

Offline sheinrich

  • CR2032 Battery
  • **
  • Posts: 22
  • Pogi/Ganda Points: 0
  • Gender: Male
  • Sven.Heinrich
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #32 on: September 22, 2009, 06:55:34 PM »
helo poh maam and sir... same lng po ba and program sa lht ng z8 gamit and C ?.. like un 40 pins and sa Z8F0822 ?
salamat po in advance
-sHeinrich
"Pay It Forward" - Trevor McKinney

Offline mArKhAo

  • Gas Turbine
  • **
  • Posts: 2284
  • Pogi/Ganda Points: 70
  • Gender: Male
  • point and shoot
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #33 on: September 22, 2009, 07:04:50 PM »
helo poh maam and sir... same lng po ba and program sa lht ng z8 gamit and C ?.. like un 40 pins and sa Z8F0822 ?
salamat po in advance
-sHeinrich

same lng po. but different i/o refer nlng sa spec sheet ;)
cut my heart out, for a souvenir....

Offline SpongeBob

  • Lead Acid Battery
  • *******
  • Posts: 660
  • Pogi/Ganda Points: 33
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #34 on: September 23, 2009, 12:42:23 PM »
^ yan ang maganda sa architecture ng Zilog, madali mag-migrate from one family to another.

Offline stealthyassassin

  • CR2032 Battery
  • **
  • Posts: 31
  • Pogi/Ganda Points: 0
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #35 on: September 26, 2009, 11:37:26 PM »
Mga sir,

Tanong ko lang po kung pwede ma-contol ng MCU ang speed ng isang DC motor gamit mga GPIO lang at walang TIMER?

Kung pwede ito, through PWM din po ba?
Pano po kaya code nito?

Halimbawa po, initially umaandar na ung DC motor, then kapag may pinindot na push-button bibilis ang ikot nung motor. Kapag hinold down ung push-button, maabot nung motor ung max speed and constant na dun.
And a different push-button para naman pabagalin ung ikot nung motor.

Pwede po marequest ang code?

Salamat po. Pasensya na po at beginner sa programming ng MCU.

Offline dairen

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #36 on: October 04, 2009, 05:26:53 PM »
Sir, ma'am, pwede puh ba magpaturo kung panuh puh gamitin ang PWM channels ng Z8FMC16100 independently para makapagkontrol ng mga servomotors???? thank you puh... need it puh for our undergraduate project.. thank oyu puh...

Offline paranz

  • Moderator
  • Nuclear Reactor
  • *****
  • Posts: 4525
  • Pogi/Ganda Points: 177
  • Gender: Male
  • 1/4W resistor specialist
    • RapidSignal Electronics
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #37 on: October 04, 2009, 06:18:52 PM »
Mga sir,

Tanong ko lang po kung pwede ma-contol ng MCU ang speed ng isang DC motor gamit mga GPIO lang at walang TIMER?

Kung pwede ito, through PWM din po ba?
Pano po kaya code nito?

Halimbawa po, initially umaandar na ung DC motor, then kapag may pinindot na push-button bibilis ang ikot nung motor. Kapag hinold down ung push-button, maabot nung motor ung max speed and constant na dun.
And a different push-button para naman pabagalin ung ikot nung motor.

Pwede po marequest ang code?

Salamat po. Pasensya na po at beginner sa programming ng MCU.

you can generate a PWM signal via software. Simply use software delay. Check my zilog encore tutorial
PIC16 Programming Tutorial using MPLAB and Hi-Tech C
www.rapidsignalph.com/tutorials/pic16-tutorials

Arduino & gizDuino Tutorials
www.rapidsignalph.com/tutorials/arduino-tutorials

Offline westwind

  • CR2032 Battery
  • **
  • Posts: 28
  • Pogi/Ganda Points: 0
  • Gender: Male
  • shadow
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #38 on: October 11, 2009, 02:33:37 PM »
mga boss...
post naman kau code in C language ng pagcontrol ng 4 servo using pwm module ng uC. Nde ko kaz maintindihan ung nahanap ko na code eh, PIC and assembly kasi ung ginamit nya....

...panu b kokontrolin ung apat, isa isa po ba na e aaces ung nga servo.
       -ganito po kasi ung naiisip ko
            -> access servo 1 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 2 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 3 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 4 then, send desired pulse width
           
           

Offline marcelino

  • Technical People
  • Solar Power Satellite
  • *****
  • Posts: 6028
  • Pogi/Ganda Points: 258
  • ...keep moving forward! - Robinson's
Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #39 on: October 11, 2009, 02:56:31 PM »
mga boss...
post naman kau code in C language ng pagcontrol ng 4 servo using pwm module ng uC. Nde ko kaz maintindihan ung nahanap ko na code eh, PIC and assembly kasi ung ginamit nya....

...panu b kokontrolin ung apat, isa isa po ba na e aaces ung nga servo.
       -ganito po kasi ung naiisip ko
            -> access servo 1 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 2 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 3 then, send desired pulse width, after mgturn sa desired angle
            -> access servo 4 then, send desired pulse width
           
           


may apat na servo controller ka din ba?
"Don't take life seriously. After all, no one has ever come out of it alive. -Bugs Bunny"

Philippine Electronics Forum

Re: Request Zilog Encore! Microcontroller codes here (C Only)
« Reply #39 on: October 11, 2009, 02:56:31 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com