Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Need help

Need help

Scheduled Pinned Locked Moved Mobile
helpworkspace
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cool Ju
    wrote on last edited by
    #1

    Hi, I doing a project using Atmel 89c51 and Keil for programming. In this, one module is to display a 4-digit number using seven segment display and a BCD decoder. I split the number in to separate digits using modulo and division operation. The first digit gets displayed correctly but the other digits are not displayed correctly. For eg: if my no is 0634 it gets displayed as 2704. This is the pseudo code int MilliSeconds=0; unsigned int Digit; unsigned int d1; int count=0; int choice=0; void InitStartTimer(void) { TCON=TCON & 0xCF; //clear timer0 flags TMOD=TMOD & 0xF9; //enable timer0 without changing timer1 setup TL0=0xC2; //Load the delay msb TH0=0xFB; //Load the delay lsb TR0=1; //start timer } void TimerIntr(void) interrupt 1 using 3 { TR0=0; if(count>=1) { P3_7=1; MilliSeconds+=1; } else count++; if(MilliSeconds==20) { switch(choice) { case 0: ch1=P1; ch2=P2&0x0F; Digit=(P2*256)+P1; d1=Digit % 10; Digit=Digit/10; d1=d1|0x10; P0=d1; choice++; break; case 1: d1=Digit%10; Digit=Digit/10; d1=d1|0x20; P0=d1; choice++; break; case 2: d1=Digit%10; Digit=Digit/10; d1=0; d1=d1|0x40; P0=d1; choice++; break; case 3: d1=Digit%10; Digit=Digit/10; d1=0; d1=d1|0x80; P0=d1; choice++; break; case 4: choice=0; break; } MilliSeconds=0; } InitStartTimer(); } The first digit gets displayed but after the division operation things get messy. Does divsion doesnot work in keil.I am a beginer. Expect ur help Thanks Cool Ju

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups