Posts

Showing posts with the label program

msp430 timer programming interrupt based

Image
Basically msp4302xxx family has two 16-bit timers. Timer A and Timer B. We will see today about Timer A. Timer A can work in four modes based on the values of MCx in TACTL register If MCx = 00 then it is in stop mode. It means the timer is stopped. If MCx = 01 then it is in Up mode. It means the timer counts up to the value present in the TACCR0 register and goes to zero and repeats the cycle If MCx = 10 then it is in Continuous mode,in which the timer counts up to the value  0xffff and jumps to zero and repeats the same. If MCx = 11 then it is in Up/Down mode where the timer counts up to the value present in the TACCR0 and starts decrementing to zero and again starts from zero to TACCR0 The timer can be sourced from either ACLK,TACLK,SMCLK and INCLK with a divisor factor upt0 8 based on the values of TASSELx and IDx in the TACTL register We will see how to program the timer A present in msp430. For programming we have to use the Timer A registers. 1) TAR: ...

How to get User Input from User in java??

program to get User Input in java import java.util.Scanner; public class UserInput { public static void main(String args[]) { Scanner obj=new Scanner(System.in); int number; String str; float f; System.out.println("Enter the String? :"); str=obj.nextLine(); System.out.println("You have entered the string:"+str); System.out.println("Enter the number ?"); number=obj.nextInt(); System.out.println("You have entered the number:"+number); System.out.println("ENter the float number"); f=obj.nextFloat(); System.out.println("YOu have entered the float value:"+f); } } java.util has a class named “scanner” which is used to read different types of values from users. Scanner obj=new Scanner(System.in); In this statement Scanner is the class name,obj is the Object of the Scanner class and System.in is the input stream. str=obj.ne...