art
Joined: 21 May 2015 Posts: 181
|
Binary output problem |
Posted: Fri Jan 15, 2016 8:43 pm |
|
|
Hai, I would like to send a 16 bit binary string to output B(8bit) and D(8bit). When I send '1111000000110011' why output B and D show '00110011'. I need output B '11110000' and output D'00110011'. How to solve this?
Code: |
#include <16F887.h>
#fuses INTRC_IO, NOWDT
#use delay(clock=4M)
#use rs232(baud=9600, UART1, ERRORS)
#include <stdlib.h>
#include <input.c>
#include <string.h>
int16 binary_string[18];
//======================
void main()
{
while (TRUE)
{
printf("Enter number: \n");
get_string(binary_string,17);
output_B((int8)strtoul(binary_string,0,2));
output_D((int8)strtoul(binary_string,0,2));
}
} |
|
|